Created
February 18, 2015 09:49
-
-
Save samelie/32ecbdd99e07b9d8806f to your computer and use it in GitHub Desktop.
ffmpeg last frame of video
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
fn="$1" | |
of=`echo $1 | sed s/mp4/jpg/` | |
lf=`ffprobe -show_streams "$fn" 2> /dev/null | grep nb_frames | head -1 | cut -d \= -f 2` | |
rm -f "$of" | |
let "lf = $lf - 1" | |
ffmpeg -i $fn -vf select=\'eq\(n,$lf\) -vframes 1 $of |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing! You could save future users some headache by adding a safety check before you run
rm -f ...
Something like:
Otherwise, any input file that isn't an mp4 will be permanently deleted.