Skip to content

Instantly share code, notes, and snippets.

@NelsonMinar
Created May 17, 2014 16:30
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save NelsonMinar/b00693feecc3b6673e36 to your computer and use it in GitHub Desktop.
Save NelsonMinar/b00693feecc3b6673e36 to your computer and use it in GitHub Desktop.
Extract last frame of a video file
#!/bin/bash
fn="$1"
of=${fn%.*}.jpg
lf=`ffprobe -show_streams "$fn" 2> /dev/null | awk -F= '/^nb_frames/ { print $2-1 }'`
rm -f "$of"
ffmpeg -i "$fn" -vf "select='eq(n,$lf)'" -vframes 1 "$of" 2> /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment