tags:

views:

587

answers:

4
+3  Q: 

how to use ffmpeg

hello .. im trying to extract frames from a video .. and i picked ffmpeg ( tell me if you know something better ) for this task
i downloaded it's source .. and i don't know how to use it ?? how do i compile it ??
what is the recommended language for it ?? i know python and C++
please note that i use windows vista 64x .

+1  A: 

If you only want use ffmpeg you should just get a build and not the source itself.

To extract a frame from a video use the following command line:

ffmpeg -i input.avi -r 1 -f image2 -s 120x96 images%05d.png

Where input.avi is your video, 120x96 the dimension of the output image. There are a lot of options you can use to specify the exact frame in the movie, but that would definetely be too much to show here. Take a look at this page to get a more detailed description.

Best wishes,
Fabian

halfdan
+1  A: 

If you just want to extract the frames from a video and save them to file, you can just use ffmpeg at the command line:

ffmpeg -i video.avi image%d.jpg

For this method, you do not need to build ffmpeg as there should be a windows binary available for download.

If you are wanting to display the frames or perform some other processing on them, you may want to use libavformat and libavcodec (main parts of the ffmpeg project) to extract the video frames in code. Here is a pretty good tutorial on how to get frames from a video using libavcodec and libavformat. libavformat and libavcodec are C libraries so I would use C or C++ if you want to interface directly to them. There is this python wrapper for ffmpeg that looks promising, but I haven't tried it.

You can download the compiled ffmpeg libraries as well so you shouldn't have to build them yourself. ffmpeg will not build on MSVC++ as per the documentation so you would have to set up a mingw environment. This site has a lot of Windows builds and tutorials on how to build the libraries if you really want to.

Jason
A: 

As far as I rembember, compiling ffmpeg is straightforward. Just follow indications in README or INSTALL files. Basically it involves a ./configure && make command.

If you want specific options you can add options to ./configure. A list is available from ./configure itself.

Some codecs are not shipped with ffmpeg, such as MP3 and AAC. You may want to download and compile them as well.

I use ffmpeg from a Cocoa/Objective-C application by spawning a separate process using a function similar to system() or popen().

mouviciel
I don't think this will help much the asker much: he is on win64 and most likley he won't be ablt to build the software there.
jsbueno
+1  A: 

If you know C++, you can modify sample from article using ffmpeg.

Direct link to sample: http://unick-soft.ru/art/files/ffmpegDecoder-vs2008.zip