Ffmpeg: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
 
No edit summary
Line 1: Line 1:
Powerful command line video tool originally written by [[Fabrice Bellard]] (under the pseudonym "Gerard Lantau")
Be sure to check you / print your own ffmpeg documentation! <br />
Be sure to check you / print your own ffmpeg documentation! <br />
http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html
http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html


== examples ==
== Convert a video into individual frames ==


extract frames (100 seconds per frame) and number the images using "zero-padded 6 digits":
The -r option sets the '''framerate'''. A framerate of .01 (or 1/100) means 100 seconds per frame. In this way you can easily make an overview of a movie:


<source lang="bash">
<source lang="bash">
ffmpeg -i rearwindow.avi -f image2 -y -r .01 -an rearwindow%06d.jpg
ffmpeg -i rearwindow.avi -f image2 -y -r .01 -an rearwindow%06d.jpg
</pre>
</pre>
The "%06d" means to "pad" (or fill) the filename to having always 6 places (so adding extra 0's before the number as necessary so that the filenames all have the right size and avoiding any problem with sorting later). This follows the convention of the C printf command).
Extract 1 frame per second (padding to 3 places):
ffmpeg -i inputfile.avi -r 1 -f image2 image-%3d.jpeg

Revision as of 10:35, 18 February 2013

Powerful command line video tool originally written by Fabrice Bellard (under the pseudonym "Gerard Lantau")

Be sure to check you / print your own ffmpeg documentation!
http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html

Convert a video into individual frames

The -r option sets the framerate. A framerate of .01 (or 1/100) means 100 seconds per frame. In this way you can easily make an overview of a movie:

<source lang="bash"> ffmpeg -i rearwindow.avi -f image2 -y -r .01 -an rearwindow%06d.jpg

The "%06d" means to "pad" (or fill) the filename to having always 6 places (so adding extra 0's before the number as necessary so that the filenames all have the right size and avoiding any problem with sorting later). This follows the convention of the C printf command).

Extract 1 frame per second (padding to 3 places):

ffmpeg -i inputfile.avi -r 1 -f image2 image-%3d.jpeg