X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=thumbnail.sh;h=8698627f37a538efd72e728100fad5a307ed4031;hb=4c469ef53af984583e8ccb4b29d051c52bba8172;hp=143077640c049f1c35dbfbc0584607855cf6986a;hpb=7db7dc21eaa620d93ab65b41ae5aa336cb501db5;p=serve0 diff --git a/thumbnail.sh b/thumbnail.sh index 1430776..8698627 100644 --- a/thumbnail.sh +++ b/thumbnail.sh @@ -6,17 +6,17 @@ include_thumbnails="$0" gen_thumb(){ file="$1"; thumb="$2"; - if [ ! -e "$thumb" ] && [ -f "$file" ]; then + if [ "${file%.part}" = "${file}" ] && [ ! -s "$thumb" ] && [ -s "$file" ]; then l="$( printf '' \ | mplayer -input nodefault-bindings -nosound -vo null -identify -frames 0 "$file" 2>&- \ | sed -rn 's:ID_LENGTH=(.*)(\..*)$:\1:p;' \ )" - chunk="$((${l:-10} / 5))" + chunk="$((${l:-10} / 11))" tmp="$(mktemp -d)" - for cnt in 1 2 3 4; do + for cnt in 1 2 3 4 5 6 7 8 9 10; do printf '' \ | mplayer -input nodefault-bindings -nosound -benchmark \ -noconfig all -really-quiet \ @@ -29,14 +29,12 @@ gen_thumb(){ printf '' \ | mplayer -input nodefault-bindings -nosound -benchmark \ -noconfig all -really-quiet \ - -vf scale=159:-2,tile=2:2:4:0:2 \ - -vo jpeg:quality=96:outdir="${tmp}"\ + -vf expand=:::::16/9,scale=320:-2,tile=10:1:10:0:0 \ + -vo jpeg:quality=100:outdir="${tmp}"\ "mf://$tmp/_*.jpg" 2>&- - mv "${tmp}/00000001.jpg" "$thumb" + #mv "${tmp}/00000001.jpg" "$thumb" + convert "${tmp}/00000001.jpg" -interlace line -quality 85 "$thumb" rm -r "${tmp}" - - elif [ ! -e "$thumb" ]; then - touch "$thumb" fi }