Reputation: 25949
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 Flex to show video's. And yes, links to some libraries would be useful.
Upvotes: 7
Views: 6378
Reputation: 163
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
Upvotes: 1
Reputation: 38868
I can think of two options off the top of my head:
Upvotes: 7
Reputation: 10247
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.
Upvotes: 4