Ffmpeg: Difference between revisions
No edit summary |
|||
Line 16: | Line 16: | ||
Extract 1 frame per second (padding to 3 places): | Extract 1 frame per second (padding to 3 places): | ||
<source lang="bash"> | |||
ffmpeg -i inputfile.avi -r 1 -f image2 image-%3d.jpeg | |||
</source> | |||
=== Setting a start time === | |||
Extract 2 fps (-r) starting at 1:45:02 (-ss) and process 10 seconds of the input (-t 10). | |||
<source lang="bash"> | |||
ffmpeg -i inputfile.avi -r 2 -ss 01:45:02 -t 10 image-%d.jpeg | |||
</source> | |||
Alternately -vframes lets you specify how many output frames you want (rather than input time)? | |||
<source lang="bash"> | |||
ffmpeg -i inputfile.avi -r 2 -ss 01:45:02 -vframes 10 image-%d.jpeg | |||
</source> |
Revision as of 09:41, 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:
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
Setting a start time
Extract 2 fps (-r) starting at 1:45:02 (-ss) and process 10 seconds of the input (-t 10).
ffmpeg -i inputfile.avi -r 2 -ss 01:45:02 -t 10 image-%d.jpeg
Alternately -vframes lets you specify how many output frames you want (rather than input time)?
ffmpeg -i inputfile.avi -r 2 -ss 01:45:02 -vframes 10 image-%d.jpeg