使用ffmpeg/mencoder/transcode等转储视频文件的最后一帧人 [英] Dump last frame of video file using ffmpeg/mencoder/transcode et. al
问题描述
我想抓住视频中的 last 帧(.mpg
,.avi
等)并将其转储到图像文件(.jpg
,.png
等)中).工具链是现代的Linux 命令行,因此mencoder
,transcode
,ffmpeg
& c之类的东西.
I'd like to grab the last frame in a video (.mpg
, .avi
, whatever) and dump it into an image file (.jpg
, .png
, whatever). Toolchain is a modern Linux command-line, so things like mencoder
, transcode
, ffmpeg
&c.
干杯, 鲍勃.
推荐答案
这不是一个完整的解决方案,但是它将为您指明正确的路径.
This isn't a complete solution, but it'll point you along the right path.
使用ffprobe -show_streams IN.AVI
获取视频输入中的帧数.然后
Use ffprobe -show_streams IN.AVI
to get the number of frames in the video input. Then
ffmpeg -i IN.AVI -vf "select='eq(n,LAST_FRAME_INDEX)'" -vframes 1 LAST_FRAME.PNG
其中LAST_FRAME_INDEX是减去一帧(索引为零的帧)的帧数,将输出最后一帧.
where LAST_FRAME_INDEX is the number of frames less one (frames are zero-indexed), will output the last frame.
这篇关于使用ffmpeg/mencoder/transcode等转储视频文件的最后一帧人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!