Split MPEG movie to jpg and bmp formats

Posted on 2006-05-29
Last Modified: 2012-08-13

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.  
Question by:bimalprakashsharma
    LVL 8

    Expert Comment

    This guy did it: (, &


    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!
    LVL 4

    Accepted Solution

    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/

    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.

    MPlayer is available under the GNU General Public License v2.
    LVL 1

    Author Comment


    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?
    LVL 4

    Expert Comment

    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.
    LVL 4

    Expert Comment

    Glad I could help.
    Thanks for the points.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Suggested Solutions

    INTRODUCTION We all know how to code. But at times you simply want to insert a common code block into your existing code and amend it as per your requirements. This tool not only saves you time but also saves you the pain of typing it all out aga…
    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now