]> git.plutz.net Git - serve0/blobdiff - thumbnail.sh
Merge commit 'b931bbd0c30907b9cc956d3707b26b449bf41f76'
[serve0] / thumbnail.sh
old mode 100644 (file)
new mode 100755 (executable)
index 4a6f828..09f5ab0
@@ -4,10 +4,11 @@
 include_thumbnails="$0"
 
 gen_thumb(){
-  local file="$1" thumb="$2" tmp="${TMPDIR:-/tmp}/serve0tmp_$$/" lenght n
+  local file="$1" thumb="$2" bgcolor="${3:-#000000}"
+  local tmp="${TMPDIR:-/tmp}/serve0tmp_$$/" lenght n
 
   if [ "${file%.part}" = "${file}" -a ! -s "$thumb" -a -s "$file" ] && mkdir "$tmp"; then
-    length="$( ffprobe -show_entries stream=duration "$file" 2>&- )"
+    length="$( ffprobe -show_entries format=duration "$file" 2>&- )"
     length="${length#*duration=}" length="${length%%${BR}*}" length="${length%.*}"
   
     # ffmpeg -nostdin -y -i "$file" -vf fps=11/$length,scale=320:-2 -frames 10 "$tmp/thumb_%02d.jpg" 2>&-
@@ -17,6 +18,7 @@ gen_thumb(){
     done
 
     montage "$tmp"/thumb_[0-9].jpg \
+            -background "$bgcolor" \
             -tile 10x1 -geometry 320x180+0+0 \
             -interlace line -quality 85 "$thumb"
     rm -r -- "${tmp}"