3 [ -n "$include_thumbnails" ] && return 0
4 include_thumbnails="$0"
7 local file="$1" thumb="$2" bgcolor="${3:-#000000}"
8 local tmp="${TMPDIR:-/tmp}/serve0tmp_$$/" lenght n
10 if [ "${file%.part}" = "${file}" -a ! -s "$thumb" -a -s "$file" ] && mkdir "$tmp"; then
11 length="$( ffprobe -show_entries format=duration "$file" 2>&- )"
12 length="${length#*duration=}" length="${length%%${BR}*}" length="${length%.*}"
14 # ffmpeg -nostdin -y -i "$file" -vf fps=11/$length,scale=320:-2 -frames 10 "$tmp/thumb_%02d.jpg" 2>&-
16 for n in 1 2 3 4 5 6 7 8 9 10; do
17 ffmpeg -nostdin -y -ss "$((n * length / 11))" -i "$file" -frames 1 "$tmp/thumb_$((n - 1)).jpg" 2>&-
20 montage "$tmp"/thumb_[0-9].jpg \
21 -background "$bgcolor" \
22 -tile 10x1 -geometry 320x180+0+0 \
23 -interlace line -quality 85 "$thumb"