I’m trying to write a plugin that generates thumbnails for videos during import. Using NReco’s ffmpeg wrapper for convenience, this is what I have so far:
using System.IO;
using System.Windows.Media.Imaging;
namespace Soletude.Stagsi.Plugins
{
public class VidThumbta
{
public static void StagsiPlugin(IPluginService service)
{
service.RegisterImageLoaderV1(RenderVid, new ImageLoaderV1 { FileExtensions = new[] { "mp4", "m4v", "avi", "mov" } });
}
private static BitmapSource RenderVid(Stream input, IImageLoadingV1 parameters)
{
var resultImageStream = new MemoryStream();
var ffMpeg = new NReco.VideoConverter.FFMpegConverter();
ffMpeg.GetVideoThumbnail(parameters.FilePath, resultImageStream);
JpegBitmapDecoder decoder = new JpegBitmapDecoder(resultImageStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapSource bmp = decoder.Frames[0];
return bmp;
}
}
}
Unfortunately it’s not working at all. Here’s what I see in the logs:
Init plugin: C:\Program Files (x86)\Stagsi\Plugins\videoThumbnailer.dll : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at ##.#Jn(PluginService , Assembly )
at Soletude.Stagsi.Plugins.PluginService.#Rh(String[] )
22-10-10 17:27:36.225: Found plugin - C:\Program Files (x86)\Stagsi\Plugins\NReco.VideoConverter.dll
Found plugin - C:\Program Files (x86)\Stagsi\Plugins\psd2pixels.dll
Found plugin - C:\Program Files (x86)\Stagsi\Plugins\PsdPlugin.dll
Found plugin - C:\Program Files (x86)\Stagsi\Plugins\TxtPlugin.dll
Found plugin - C:\Program Files (x86)\Stagsi\Plugins\WpfPlugin.dll
Found plugin - C:\Program Files (x86)\Stagsi\Plugins\XamlTune.dll
Found plugin - C:\Program Files (x86)\Stagsi\Plugins\XamlTunePlugin.dll
So it seems like it’s probably failing to find one of its dependencies? But the only dependencies are components of Stagsi and the NReco.VideoConverter.dll which is present in the plugins folder along with my built DLL.
Unfortunately I know very little about .NET development so I’m not sure how to debug this further - any ideas? is it possible to get more logging out of Stagsi about loading plugins?