[FFmpeg-user] Extracting last frame from video as webp image

Davison Long dlong at nextgentech.net
Mon Jun 12 22:43:23 EEST 2023


I've come across several examples of extracting the last frame of a video as an image by seeking one or two seconds from the end of the video and using the update option to overwrite the static destination file (so as not to use a pattern that produces multiple images files).

This works great for formats like PNG or even GIF using a command like:
ffmpeg -sseof -1s -i source.mkv -fps_mode passthrough -update 1 -f image2 last_frame.png

However, the same command used with the webp format for the output image doesn't work:
ffmpeg -sseof -1s -i source.mkv -fps_mode passthrough -update 1 -f image2 last_frame.webp

This command produces an animated WEBP file that includes ALL frames from the seek starting point (which in this case is one second from the end).  Interestingly turning the update option off produces the same result, so it appears the update option is broken for WEBP output.  On a somewhat related note, omitting the "-f image2" format specifier also produces the same result but the resulting animated WEBP file doesn't loop.

I'm just trying to get the very last frame as a non-animated WEBP image (primarily because the compression is way better than TIFF or PNG and the quality is better than JPEG).

-Davison Long



More information about the ffmpeg-user mailing list