Changes between Version 6 and Version 7 of Create a thumbnail image every X seconds of the video
- Timestamp:
- Feb 21, 2015, 2:30:13 AM (12 years ago)
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 3 Output a single frame from the video into an image file: 4 2 5 {{{ 3 ffmpeg -i input.flv -ss 00:00:14.435 - f image2 -vframes 1 out.png6 ffmpeg -i input.flv -ss 00:00:14.435 -vframes 1 out.png 4 7 }}} 5 8 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 pngfile.9 This 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. 7 10 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 13 Output one image every second, named `out1.png`, `out2.png`, `out3.png`, etc. 14 9 15 {{{ 10 ffmpeg -i input.flv - f image2 -vf fps=fps=1 out%d.png16 ffmpeg -i input.flv -vf fps=1 out%d.png 11 17 }}} 12 18 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)'' 19 Output 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 15 21 {{{ 16 ffmpeg -i myvideo.avi - f image2 -vf fps=fps=1/60 img%03d.jpg22 ffmpeg -i myvideo.avi -vf fps=1/60 img%03d.jpg 17 23 }}} 18 24 19 This will create one thumbnail image every 10 minutes, named thumb0001.bmp, thumb0002.bmp, thumb0003.bmp, ... 25 Output one image every ten minutes: 26 20 27 {{{ 21 ffmpeg -i test.flv - f image2 -vf fps=fps=1/600 thumb%04d.bmp28 ffmpeg -i test.flv -vf fps=1/600 thumb%04d.bmp 22 29 }}} 23 30 24 This will create one thumbnail image every I-frame, named thumb0001.bmp, thumb0002.bmp, thumb0003.bmp, ... 31 = `select` video filter = 32 33 Output one image for every I-frame: 34 25 35 {{{ 26 ffmpeg -i input.flv - f image2 -vf "select='eq(pict_type,PICT_TYPE_I)'" -vsync vfr thumb%04d.png36 ffmpeg -i input.flv -vf "select='eq(pict_type,PICT_TYPE_I)'" -vsync vfr thumb%04d.png 27 37 }}} 28 38 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 === 31 40 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]
