Thumbnail video C#
Is it possible to create a thumbnail image of a video in C# (like the first frame)?
Little update: I'll need a thumbnail image of an FLV video in C# since I'm using Fl开发者_开发问答ex to show video's. And yes, links to some libraries would be useful.
I can think of two options off the top of my head:
- Use an external tool, like ffmpeg, to generate thumbnails. This is probably the most commonly implemented solution to this problem.
- Parse the FLV file and only send the file only to the end of the first I Frame. (You can find the parsing logic in code that allows you to seek into the middle of an FLV by time mark.
There are Open Source libraries you can use to do this. Check out OpenCVDotNet, a managed .NET wrapper for OpenCV, a "computer vision" library. Here's a link to a tutorial you may find useful.
This works:
ShellFile thumbNail = ShellFile.FromFilePath(<fullpath and filename>);
Bitmap thumbSmall = thumbNail.Thumbnail.MediumBitmap;
Bitmap thumbLarge = thumbNail.Thumbnail.LargeBitmap;
videoThumb_Small.Images.Add(thumbSmall);
videoThumb_Large.Images.Add(thumbLarge);
where 'videoThumb_?????' = ImageList (where to control size of the image to display again). Slow as hell when searching different MIME formats, but fast enough with same types. Needs:
using Microsoft.WindowsAPICodePack.Shell;
using Microsoft.WindowsAPICodePack;
and you can get Microsoft.WindowsAPICodePack from nuget package with same name. As for FFMpeg, Vlc.Dotnet or aXMediaPlayer(WMP) they all suck as far I've tested(Vlc doesn't even work as it should, FFmpeg again needs 500 million lines before you get same result and aXMediaPlayer well, heh) them beside that's Windows native.
Example, if you're using ListView with something like subitems even:
for(int mememe = 0; mememe < stuff_counter; mememe++)
{
listview1.Items.Add("strings", mememe).SubItems.Add("strings" + mememe.ToString());
}
Would then read the correct index number from ImageList
精彩评论