Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ .NET Video MPEG
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.
 
Ideally,
FrameReader* Reader= new FrameReader("MyFile.mpg");
while (Reader.NextFrame())
{
    Bitmap* Frame= Reader.GetFrame();
 
    ...
}
Reader.Close();
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 4:01am
Comments
TRK3 at 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 at 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 at 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 at 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 at 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
good
Please Sign up or sign in to vote.

Solution 1

Did you look at this before:
Extract Frames from Video Files[^]
  Permalink  
Comments
YvesDaoust at 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
0 Sergey Alexandrovich Kryukov 9,108
1 OriginalGriff 8,186
2 CPallini 2,613
3 Richard MacCutchan 2,231
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 13 Sep 2012
Copyright © CodeProject, 1999-2014
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