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.
Cheers, Bob.
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.
Cheers, Bob.
One thing I have not seen mentioned is that the expected frame count can be off if the file contains dupes. If your method of counting frames is causing your image extraction command to come back empty, this might be what is mucking it up.
I have developed a short script to work around this problem. It is posted here.
This isn't a complete solution, but it'll point you along the right path.
Use
ffprobe -show_streams IN.AVI
to get the number of frames in the video input. Thenwhere LAST_FRAME_INDEX is the number of frames less one (frames are zero-indexed), will output the last frame.
I have a mp4 / h264 matroska input video file. And none of the above solutions worked for me. (Although I sure they work for other file formats).
Combining samrad's answer above and also this great answer and came up with this working code:
I couldn't get Nelson's solution to work. This worked for me. https://gist.github.com/samelie/32ecbdd99e07b9d8806f
EDIT (just in case the link disappears, here is the shellscript—bobbogo):