简体   繁体   中英

Quicky output selection of video frames using ffmpeg

I would like to extract, say, 10 video frames from a given video file using ffmpeg, ideally uniformly distributed throughout the video. I know this can be done in a few ways, for example

ffmpeg -i input.mp4 -vf fps=1/10 out%03d.jpg

will output one image every 10 seconds. However, this is too slow for my liking and scales proportionally with the length of the video. I have read a bit about ffmpeg's seeking capability, for example

ffmpeg -ss 00:00:05 -i input.mp4 -frames:v 1 out001.jpg

will very quickly seek to the 5th second of the video and extract one frame. However I haven't come across a way to seek to multiple locations in the video without calling the above command repeatedly at various times.

Is there a quicker way of accomplishing this?

Using a long command, this can be done

eg

ffmpeg -ss 00:00:05 -i input.mp4
       -ss 00:01:05 -i input.mp4
       -ss 00:03:05 -i input.mp4
       -ss 00:40:05 -i input.mp4 
       -map 0:v -frames:v 1 out001.jpg
       -map 1:v -frames:v 1 out002.jpg
       -map 2:v -frames:v 1 out003.jpg
       -map 3:v -frames:v 1 out004.jpg

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM