21

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.

Komal Raghav
  • 211
  • 1
  • 2
  • 5

1 Answers1

24

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.

Gyan
  • 34,439
  • 6
  • 56
  • 98
  • 1
    This 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. – Rublacava Jul 02 '20 at 10:22
  • Share full log. – Gyan Jul 02 '20 at 18:54
  • `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 tried `ffmpeg -sseof -3 -i input -update 1 -vframes 1 last.png` with a .mov video and it also didn't work. – Rublacava Jul 10 '20 at 21:12
  • Open a new Q and include command and *full* log. – Gyan Jul 11 '20 at 05:28
  • This outputs an mp4. – tommy.carstensen Mar 23 '21 at 17:59
  • @tommy.carstensen Open a new Q with command and full log. – Gyan Mar 23 '21 at 18:19
  • @Gyan No, you should fix your answer. – tommy.carstensen Mar 23 '21 at 18:25
  • Why do you think it outputs a MP4? – Gyan Mar 23 '21 at 19:00
  • @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? – phip Oct 26 '21 at 05:02