All pastes #942619 Raw Edit

Stuff

public shellscript v1 · immutable
·published 2008-03-14 17:33 UTC
rendered paste body
#!/bin/bash# Licensed under the WTFPL (http://en.wikipedia.org/wiki/WTFPL)# Generates a strip of thumbnails for all videos in a directory# Usage: videothumbnailer [number of thumbs] [width (0=original width)]SIZE=200NUM_THUMBS=10if [ -n "$1" ]; then    NUM_THUMBS=$1fiif [ -n "$2" ]; then    WIDTH=$2fils *AVI *MPG *WMV *WMV *flv *mov *asf *wmv *mpeg *avi *mpg  2>/dev/null |(while read file; do    printf "%s.. " "$file"    eval $(midentify "$file" |sed 's/\..*//')    printf "length: %d\n" "$ID_LENGTH"    rm -f "$file"*jpg    if [ "$WIDTH" = "0" ]; then        W=$ID_VIDEO_WIDTH    else        W=$WIDTH    fi    for t in $(seq 5 $(expr $ID_LENGTH / $NUM_THUMBS) $ID_LENGTH); do        printf "  Screenshot at %d.. " "$t"        gnome-video-thumbnailer --jpeg --size $W --time $t "$file" "$file-$t.jpg" >/dev/null 2>&1 && echo "done" || echo "fail"    done    rename "s/-([0-9]).jpg/-000\$1.jpg/;s/-([0-9][0-9]).jpg/-00\$1.jpg/;s/-([0-9][0-9][0-9]).jpg/-0\$1.jpg/" *.jpg    montage -geometry +0+0 -tile 1x "$file"-*.jpg "${file}.jpg"    rm -f "$file"-*.jpgdone)