FFmpeg : How to get last frame from a video
11,365
Use
ffmpeg -sseof -3 -i input -update 1 -q:v 1 last.jpg
This will seek to the last three seconds of the input and output all frames. But since -update 1
is set, each frame will be overwritten to the same file, leaving only the last frame remaining.
Related videos on Youtube
Author by
Komal Raghav
Updated on September 18, 2022Comments
-
Komal Raghav over 1 year
I have a video.mp4 file i want to get last frame from video/mp4 file and save as a image in local. If it is possible then please suggest me.
Thanks.
-
Rublacava almost 4 yearsThis isn't a problem to me, but for some reason the PNG version of this --
ffmpeg -sseof -3 -i input -update 1 -vframes 1 last.png
-- doesn't work. -
Gyan almost 4 yearsShare full log.
-
Rublacava almost 4 years
ffmpeg -sseof -3 -i AVI300.avi -update 1 -vframes 1 last.png
=ffmpeg version N-91990-g49c67e79ca Copyright (c) 2000-2018 the FFmpeg developers\built with gcc 8.2.1 (GCC) 20180813\[...]\-sseof value seeks to before start of file AVI300.avi; ignored\Input #0, avi, from 'AVI300.avi':\Duration: 00:00:02.60, start: 0.000000, bitrate: 36 kb/s[...]
- not the full log, but it has the important parts I think. I triedffmpeg -sseof -3 -i input -update 1 -vframes 1 last.png
with a .mov video and it also didn't work. -
Gyan almost 4 yearsOpen a new Q and include command and full log.
-
tommy.carstensen about 3 yearsThis outputs an mp4.
-
Gyan about 3 years@tommy.carstensen Open a new Q with command and full log.
-
tommy.carstensen about 3 years@Gyan No, you should fix your answer.
-
Gyan about 3 yearsWhy do you think it outputs a MP4?
-
phip over 2 years@tommy.carstensen Works for me outputting to PNG on ffmpeg v4.4. Are you getting an MP4 file out? Does it have the same name as the output file you specify (last.png)? Is it just one frame or the last 3 seconds of the input?