tags:

views:

2038

answers:

3

Hello,

Does anyone know if it is possible to grab a frame/image from a video (.wmv) on position X using C# without installing DirectX and working on Windows 2008 (a webserver I would like to install as less as possible).

Or even a simple solution with directx could be nice.

Henk

+1  A: 

You should try FFmpeg.

Eli Grey
I know someone who had to capture thumbnails from videos and he used FFmpeg but had to build from trunk to get the latest features that allowed him to do so. I'm not sure if it has since then been part of a full release. It worked for him really well.
Joel
+2  A: 

What you'll actually need to look into is DirectShow, the general-purpose media (both audio and video) library for Windows. It used to be part of DirectX but several years ago it branched off and became part of the Windows (Platform) SDK. I should also point out here that it's now been deprecated since Windows Vista in favour of Media Foundation. From what I've read it's a much better library (DirectShow is hell for complex tasks), but unfortunately it's not really feasible to only target Media Foundation at the moment because of the lack of support for XP and earlier...

The best I can really do is point you to DirectShow.NET, a .NET wrapper library for DirectShow, which is rather stable and well tested at the moment. It includes various samples which should help you get going, but by no means will it be a straightforward solution. Also, I strongly recommend you take a look at this CodeProject article/sample application. It deals with both webcam video capture and video playback from files (including WMV). A bit of playing around with that, and learning how to do frame seeking/single frame capture (I think that project might even some code to do that) should get you what you need. Perhaps you'll even find the precise solution somewhere within the DirectShow.NET samples of that CodeProject app.

Of course, I would suggest an easier solution if I could here, but you're pretty much stuck with the horribleness that is DirectShow for the moment. Good luck anyway!

Noldorin
Tried DirectShow.Net, works on vista, but can't get it to work on windows 2008 :(
Henk
Hmmm... that sounds quite strange - there shouldn't be any particular reason why it should fail on Windows Server 2008. Perhaps this is something to do with the fact that it uses the Windows SDK v6.1 rather 6.0 (Vista)? It's worth just trying to run the native (C++) samples of the SDK on that PC.
Noldorin
I seem to miss qedit.dll on the windows 2008 machine :(
Henk
Have you checked whether this qedit.dll file is missing on other Server 2008 machines?
Noldorin
A: 

Take a look at the Windows Media Format SDK, which is designed to give you pretty direct access to the frames inside a WMV (/WMA/ASF) file.

http://msdn.microsoft.com/en-us/library/dd757738(VS.85).aspx

In particular, you're interested in the synchronous API for reading these files (IWMSyncReader is the interface name). There are some pretty decent samples in the WMFSDK; I believe the most interesting one for you here will be WMSyncReader, which will show you how to dig through a WMV file and get frames, starting at position X.