3 # Calin-Andrei Burloiu, 2010, calin.burloiu@gmail.com
5 # This script extracts a thumbnail from a random frame of a video file.
10 echo "Usage: $0 input-video output-image resolution"
17 FFMPEG=/usr/bin/ffmpeg
19 if test ! -f "$IN"; then
20 echo "Error: No such file $IN"
24 # Choose a random frame
25 DURATION=$(mediainfo --Inform="General;%Duration%" "$IN" | cut -d"." -f1)
26 SEEK_POINT=$(($DURATION * $RANDOM / 32767 / 1000))
28 "$FFMPEG" -i "$IN" -ss "$SEEK_POINT" -vframes 1 -s "$RESOLUTION" -f image2 "$OUT"