I'm creating the file manager in .NET core using c# and devexpress control filemanager. for this I want to generate thumbnails for video files but it is for commercial purpose so I cant use FFMPEG for the same. Any help will be appreciated.
I tried MediaToolkit but it didn't worked in .Net Core. I have checked the solutions like
But many from this above solutions requires FFMPEG.exe which I cant use commercial purpose.
ShellFile
is available, but it does not seem to support .net 5 and .net6 versions. If you use version 3.1, you can try this.
You need to install two Nuget packages: Microsoft-WindowsAPICodePack-Shell
and System.Drawing.Common
. Here you need to pay attention to the choice of Microsoft-WindowsAPICodePack-Shell
:
Test Code:
public IActionResult Index()
{
ShellFile shellFile = ShellFile.FromFilePath("file path\\filename");
Bitmap bitmap = shellFile.Thumbnail.Bitmap;
bitmap.Save("File output path\\filename", System.Drawing.Imaging.ImageFormat.Jpeg);
return View();
}
For example, I output it to the Models folder:
For more details, you can refer to this link.