0

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

  1. NReco
  2. MediaToolkit.NetCore
  3. ShellFile
  4. Xabe.FFmpeg

But many from this above solutions requires FFMPEG.exe which I cant use commercial purpose.

  • Find out how to play a video using C# and from there just screenshot the frames you need (_eg:_ you can [try using MediaElement](https://www.c-sharpcorner.com/UploadFile/dpatra/take-screen-shot-from-media-element-in-wpf/). – VC.One Dec 09 '22 at 12:28

1 Answers1

0

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:

enter image description here

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:

enter image description here

For more details, you can refer to this link.

Chen
  • 4,499
  • 1
  • 2
  • 9