简体   繁体   中英

Extract final frame from a video using ffmpeg

I know how to extract the first frame by using

ffmpeg -ss 00:00:00 -i input.mp4 -vframes 1 -q:v 31 output.png

Here, the option -ss requires to know the exact time of the frame to extract.

I would like to have the final frame of any.mp4 without knowing the exact final time of the video.

Is there a way to achieve this?

Use

ffmpeg -sseof -3 -i file -vsync 0 -q:v 31 -update true out.jpg

-sseof seeks from the end - I've used a value of 3, to account for files with longer audio streams. -update is an image2 muxer option which tells ffmpeg to overwrite the output file. So the last time the output will be overwritten is when the last frame is processed.

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