Linux Video
Converting Video to Images
To convert a video (e.g. P1100864.MP4) to a series of image (in this case output_001.jpg, output_002.jpg, etc) you need the following command:
$ ffmpeg -i P1100864.MP4 -vf "select='eq(pict_type,PICT_TYPE_I)'" -vsync vfr -qscale:v 2 output_%03d.jpg
- With
-vf "select='eq(pict_type,PICT_TYPE_I)'"
you specify a select-filter which extracts the key-frames. Alternatively you can use -r 5
to extract 5 images from one second.
- With
-vsync vfr
you remove one of two images, if both have the same timestamp.
- With
-qscale:v 2
you specify a image quality, between 2 (best) and 31 (worst).
- With
output_%03d.jpg
you specify an output file, where the numbers are padded with zeros to a width of 3.
Source: Stackoverflow