Click here to Skip to main content
13,249,174 members (32,346 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I need to get still images from an MPEG file (.mpg extension), in sequential order.

I have looked up the Web and MSDN Library but found no suitable solution. I had used Video for Windows and IMediaDet in the past for this task on .avi files, but they don't support my MPEG files.

I want something as simple as it deserves to be, preferably using standard .NET features.

FrameReader* Reader= new FrameReader("MyFile.mpg");
while (Reader.NextFrame())
    Bitmap* Frame= Reader.GetFrame();

rather than headaches coding with DirectX or similar. (All right, I know I am dreaming, but I am sure there are solutions under the 200 lines of code.)
Posted 13-Sep-12 5:01am
TRK3 13-Sep-12 18:29pm
There are open source mpeg decoding libaries. Most of them are going to be written in C. Are you willing to deal with mixed native / managed code?
YvesDaoust 14-Sep-12 2:20am
I don't mind mixing native and managed code. I am looking for a solution that I can put at work in a couple of hours. Can you recommend me one that has a straightforward API?
YvesDaoust 14-Sep-12 3:08am
I made an attempt with FFmpeg and quickly ran into portability problems with the MSVC environment (missing include files, vararg macros...), all requiring ad-hoc adaptations at various places.

This is exactly what I want to avoid. Dealing with such mammuth packages is a pain in the neck.
TRK3 14-Sep-12 13:35pm
I haven't used one in a Windows environment. I had a relatively painless experience with a FFmpeg library in an iOS environment -- but I found one that had been specifically ported to that environment and was pleasantly surprised to find that it built without my having to do anything.

Unless someone else has already done the port to Windows and you can just download it and build it, it does become rather precarious pretty fast.

Somebody must have a suggestion though.
YvesDaoust 14-Sep-12 14:06pm
I made yet another attempt with the FilgraphManagerClass object. It has all the bells and whistles I need, like RenderFile, Run, Pause, GetCurrentImage, CurrentPosition...

Unfortunately, I found no way of getting frame-by-frame resolution :(

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Did you look at this before:
Extract Frames from Video Files[^]
YvesDaoust 14-Sep-12 2:25am
No I didn't, thank you for pointing me at it.

Unfortunately, I tried the IMediaDet interface and it does not work with my file. It just reports 0 output streams in it.

This is confirmed by the Demo application that comes with the article.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.171114.1 | Last Updated 13 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100