Sign in to follow this  
coolblue

[.net] Video capture

Recommended Posts

coolblue    162
Does anyone know of any code examples to split a mpeg video into seperate frames and save them as jpgs? or alternatively grab frames from a webcam at least 30 times a second? I have found code to do this but it either only runs at 15 fps or uses the ridiculously bloated directshow which needs over 400 lines of code!!!! I can't believe there is not a simple way to do this in this age of the webcam and video calls! I could probably do with the first example more than the second as this would mean that I could video with a far superior Camcorder and get the frames from the mpeg. Speed of capture is very important as I am filming high speed action. I am programming this in c# 1.1 but code in 2.0 would be fine as I am moving over to this soon anyway. note, I do not necessarily need to display the video I just need to split it into frames. Thank you in advance.

Share this post


Link to post
Share on other sites
DrGUI    402
I'm sure there was some library on CodeProject; sorry I don't have time to look for you now, gtg in like 2 seconds. Try searching for 'video'.

Share this post


Link to post
Share on other sites
RipTorn    722

you have two options that I can think of.

You either use DirectShow. DirectShow is a very complex api, yes, however it's complex for a reason, that being that media playback is a very complex thing to do. However that doesn't mean playing a media file is complex, the api actually makes it fairly simple, it's just if you account for everything that may go wrong (and there is a lot) things do get bloated. You will probably find the sample you have is accounting for every possibility.

Unfortunatly microsoft does not fully support directShow in managed directx. This I don't blame them for.
However there are .net wrappers avaliable. Check codeproject here.

You might notice I said 'fully'. There is, however, Microsoft.DirectX.AudioVideoPlayback. Unforunatly, from what I can tell, there is no way to get the image data from this set of classes as they are designed for use with direct3D (you could, however, take the video texture it provides, render it to a dynamic texture, lock the dynamic texture and read back the pixel data, but I would not recommend this approach).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this