简体   繁体   English

使用 ffmpeg 从视频中提取最终帧

[英]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.在这里,选项-ss需要知道提取帧的确切时间。

I would like to have the final frame of any.mp4 without knowing the exact final time of the video.我想在不知道视频的确切最终时间的情况下获得 any.mp4 的最后一帧。

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. -sseof从末尾开始搜索 - 我使用了 3 的值来说明具有较长音频流的文件。 -update is an image2 muxer option which tells ffmpeg to overwrite the output file. -update是一个 image2 复用器选项,它告诉 ffmpeg 覆盖 output 文件。 So the last time the output will be overwritten is when the last frame is processed.所以最后一次覆盖 output 是在处理最后一帧时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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