Split MPEG movie to jpg and bmp formats

Hi,

I need to take an mpeg movie file and the c++ code will split it into jpg frames and save it to a folder. I need to do this using code so trying out a ready made software will not work for me.

Can someone help please.  
LVL 1
bimalprakashsharmaAsked:
Who is Participating?
 
NicoLaanCommented:
Would using a command line util do the trick for you?
mplayer / mencoder can do this using command line paramaters so you can still call it from code.
Examples found in help and internet, not tested by me:
mplayer video.nut −vo gif89a:15.0:test.gif
mplayer -frames 1 -vo jpeg outdir=/tmp:quality=75 path/to/movie.mov

trying to create your own mpeg player / ripper sounds like a hell of a job.
As an alternative, you could look at the source code and cooperate it in your software.
Check the license details for that.

http://www.mplayerhq.hu/design7/news.html

MPlayer is available under the GNU General Public License v2.
http://www.gnu.org/licenses/gpl.txt
0
 
YoungBonziCommented:
This guy did it: http://www.codecomments.com/archive286-2005-1-374106.html
http://berniedev.tripod.com/berniedev_site/Index.htm (http://berniedev.tripod.com/berniedev_site/Download/Package/MpegLib.zip, http://berniedev.tripod.com/berniedev_site/Download/Package/SampleMPEG.zip & http://berniedev.tripod.com/berniedev_site/Download/Package/OptLib.zip)

----------

But if I had to do it from scratch, I would probably figure out how to play mpegs in DirectX (DirectShow or D3D). THen I would learn how to pause it. Then how to grab a frame to the clipboard or to a file, and manipulate the file/object into a jpeg. Then I'd go about automating that until the end of the mpeg.

I think that method may be easier for me than trying to understand someone else's code.

But good luck!
0
 
bimalprakashsharmaAuthor Commented:
NicoLaan,

Your first option using the mplayer is interesting. But how do I run the command line util from c++?

Can you please post some sample code?
0
 
NicoLaanCommented:
Sorry, no c++ expert. Also depends what c++ I think (msvc 6.0, or from visual studio 2005, Borland, djgpp, GNU, other?)
I know all languages have some fairly easy way to do this.

Please search with google something like:
c++ execute dos command "your C++ flavour name"

For a test you can first execute notepad that's more easy.
Then test with parameters, i.e. notepad Test.txt
And then you're ready for the mplayer test.
0
 
NicoLaanCommented:
Glad I could help.
Thanks for the points.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.