6 if [ -e "$video" -a \! -e "$thumb" ]; then
7 echo '' |mplayer -input nodefault-bindings -nosound -vo null -frames 0 -identify "$video" \
9 | sed -rn 's:^.*ID_LENGTH=(.*)(\..*)$:\1:p;
10 s:^.*ID_VIDEO_HEIGHT=(.*)$:\1:p;
11 s:^.*ID_VIDEO_WIDTH=(.*)$:\1:p;' \
13 | read length height width 2>/dev/null
15 [ "$(($height * 1000 / $width))" -gt "750" ] && width="$((75 * $width / $height))" \
17 [ -z $width ] && width=100
18 chunk="$((${length:-0} / 5))"
21 for cnt in 1 2 3 4; do
22 echo '' |mplayer -input nodefault-bindings -nosound -vo jpeg:outdir="$tmp" -frames 1 \
23 -benchmark -vf framestep=I,scale="$width":-2 -ss "$(($cnt*$chunk))" "$video" >/dev/null 2>/dev/null
24 mv "$tmp/00000001.jpg" "${tmp}/_${cnt}.jpg"
26 montage "${tmp}"/_[1234].jpg -tile 2x2+0+0 -geometry 100x75+3+3 -background '#000000' "${thumb}"