Last active
June 6, 2017 07:18
-
-
Save qgp9/1bde6db5b27994adc369121b13c4aa00 to your computer and use it in GitHub Desktop.
Make a tumbnail of snapshots from a movie clip
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 | |
x=$1; | |
time { | |
TMPDIR=$(mktemp -d); | |
if [[ -z "$TMPDIR" || ! -d "$TMPDIR" ]];then exit 1;fi | |
avconv -i "$x" 2>&1 | perl -nle'/Duration:\s+(\d+):(\d+):(\d+)/ and $s=$1*3600+$2*60+$3}{for($i=60;$i<$s;$i+=int(($s-60)/20)){print $i}' | while read t;do | |
avconv -y -ss $t -i "$x" -f mjpeg -vframes 1 -s 320x240 $TMPDIR/tmp`printf "%06d" $t`.jpg; | |
done && montage $TMPDIR/tmp*.jpg -tile 5x -geometry +2+2 "$x".thumb1.jpg;# && rm $TMPDIR/tmp*.jpg | |
} 2>makethum.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment