Skip to content

Instantly share code, notes, and snippets.

@rsadwick
Created November 16, 2025 21:04
Show Gist options
  • Select an option

  • Save rsadwick/15f76014e290f243cfae732085e5039d to your computer and use it in GitHub Desktop.

Select an option

Save rsadwick/15f76014e290f243cfae732085e5039d to your computer and use it in GitHub Desktop.
FFMPEG: Get last frame as image
#get duration
D=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 skate3.mp4)
#compute seek before end
SEEK=$(awk -v d="$D" 'BEGIN{printf "%.3f", (d>0.1?d-0.1:0)}')
#seek and dump one frame
ffmpeg -i skate3.mp4 -ss "$SEEK" -frames:v 1 -q:v 2 last_frame3.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment