DEV Community

Cover image for How to Grab the Last Frame of a Video for Your Next Shot
Joey
Joey

Posted on

How to Grab the Last Frame of a Video for Your Next Shot

I have a short video, and I want to use its last frame as the starting image for the next shot. I can grab that frame with a single FFmpeg command or capture it directly in Astorie Canvas. Here’s how to do both.

Pull the frame in Canvas

  1. Add a Tool node and choose Keyframe Extraction
  2. Connect the source video node to it.
  3. Use the last-frame action to save the ending as a JPEG. To capture a moment in the middle, move the preview to that image and capture the current frame.

For a continuation, I’d pass the ending still to a video node that accepts a starting image. If the clip ends in a fade or the skier is blurred, I’d pick a nearby frame where I can see the skier’s position clearly.

The opening frame shows a skier high on a steep slope. The closing frame shows the skier farther downhill with a mountain ridge behind them.The opening and closing frames, extracted from the downloaded MP4 with FFmpeg.

Save the ending from a local MP4

If I already have a short MP4 on disk, this command saves its last decoded video frame as a PNG:

ffmpeg -i "astorie - Video-1-03.mp4" -map 0:V:0 -vf reverse -frames:v 1 last.png
Enter fullscreen mode Exit fullscreen mode

reverse puts the ending frame first, and -frames:v 1 writes just that frame. The filter buffers the full clip, so I use it for short exports like this one. FFmpeg reverse filter documentation

Top comments (0)