Changes between Version 6 and Version 7 of Create a thumbnail image every X seconds of the video


Ignore:
Timestamp:
Feb 21, 2015, 4:30:13 AM (5 years ago)
Author:
llogan
Comment:

cleanup

Legend:

Unmodified
Added
Removed
Modified
  • Create a thumbnail image every X seconds of the video

    v6 v7  
    1 If you want to extract just a single frame from the video into an image file, you can use the following command line:
     1= `-vframes` option =
     2
     3Output a single frame from the video into an image file:
     4
    25{{{
    3 ffmpeg -i input.flv -ss 00:00:14.435 -f image2 -vframes 1 out.png
     6ffmpeg -i input.flv -ss 00:00:14.435 -vframes 1 out.png
    47}}}
    58
    6 This will seek to the position of 0h:0m:14sec:435msec into the movie and extract one frame (-vframes 1) from that position into a png file.
     9This example will [[Seeking|seek]] to the position of 0h:0m:14sec:435msec and output one frame (`-vframes 1`) from that position into a PNG file.
    710
    8 But, what if you want to extract thumbnails periodically? This will create one thumbnail image every second, named out1.png, out2.png, out3.png, ...
     11= `fps` video filter =
     12
     13Output one image every second, named `out1.png`, `out2.png`, `out3.png`, etc.
     14
    915{{{
    10 ffmpeg -i input.flv -f image2 -vf fps=fps=1 out%d.png
     16ffmpeg -i input.flv -vf fps=1 out%d.png
    1117}}}
    1218
    13 This will create one thumbnail image every minute, named img001.jpg, img002.jpg, img003.jpg, ...
    14 ''(%03d means that ordinal number of each thumbnail image should be formatted using 3 digits)''
     19Output one image every minute, named `img001.jpg`, `img002.jpg`, `img003.jpg`, etc. The `%03d` dictates that the ordinal number of each output image will be formatted using 3 digits.
     20
    1521{{{
    16 ffmpeg -i myvideo.avi -f image2 -vf fps=fps=1/60 img%03d.jpg
     22ffmpeg -i myvideo.avi -vf fps=1/60 img%03d.jpg
    1723}}}
    1824
    19 This will create one thumbnail image every 10 minutes, named thumb0001.bmp, thumb0002.bmp, thumb0003.bmp, ...
     25Output one image every ten minutes:
     26
    2027{{{
    21 ffmpeg -i test.flv -f image2 -vf fps=fps=1/600 thumb%04d.bmp
     28ffmpeg -i test.flv -vf fps=1/600 thumb%04d.bmp
    2229}}}
    2330
    24 This will create one thumbnail image every I-frame, named thumb0001.bmp, thumb0002.bmp, thumb0003.bmp, ...
     31= `select` video filter =
     32
     33Output one image for every I-frame:
     34
    2535{{{
    26 ffmpeg -i input.flv -f image2 -vf "select='eq(pict_type,PICT_TYPE_I)'" -vsync vfr thumb%04d.png
     36ffmpeg -i input.flv -vf "select='eq(pict_type,PICT_TYPE_I)'" -vsync vfr thumb%04d.png
    2737}}}
    2838
    29 '''Explanation:'''
    30 By telling FFmpeg to set the output file's FPS option (frames per second) to some very low value, we made FFmpeg drop a lot of frames at the output, in order to achieve such a low frame rate, effectively having our thumbnails generated every X seconds :)
     39=== Also see ===
    3140
    32 '''See also:'''
    33 [[Create a video slideshow from images]]
     41* [[Create a video slideshow from images]]
     42* [https://ffmpeg.org/ffmpeg-filters.html#fps fps video filter documentation]
     43* [https://ffmpeg.org/ffmpeg-filters.html#select_002c-aselect select filter documentation]