update thumb generator script
This commit is contained in:
parent
74613daf2e
commit
ce800b9ddb
@ -1,17 +1,20 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
input_file_path=$1
|
||||
|
||||
# Get the number of frames, fallback to 100 if missing
|
||||
nb_frames=$(ffprobe -v error -select_streams v:0 -show_entries stream=nb_frames -of default=noprint_wrappers=1:nokey=1 "$input_file_path")
|
||||
|
||||
# Fallback if nb_frames is empty or "N/A"
|
||||
if [ -z "$nb_frames" ] || [ "$nb_frames" = "N/A" ]; then
|
||||
echo "nb_frames was ${nb_frames} which is unsupported. Are you trying this on a .ts file? (It may not work on ts, try mp4.) Exiting."
|
||||
exit 555
|
||||
fi
|
||||
|
||||
sep=$((nb_frames/25))
|
||||
|
||||
# Generate a 5x5 tile thumbnail
|
||||
ffmpeg -i "$input_file_path" -vf "select=not(mod(n\,max(1\,$sep))),scale=160:-1,tile=5x5" -vsync 0 -update 1 -frames:v 1 "${input_file_path%.*}-thumb.png"
|
||||
vcsi "${input_file_path}" \
|
||||
--metadata-position hidden \
|
||||
--metadata-margin 0 \
|
||||
--metadata-horizontal-margin 0 \
|
||||
--metadata-vertical-margin 0 \
|
||||
--grid-spacing 0 \
|
||||
--grid-horizontal-spacing 0 \
|
||||
--grid-vertical-spacing 0 \
|
||||
--timestamp-horizontal-margin 0 \
|
||||
--timestamp-vertical-margin 0 \
|
||||
--timestamp-horizontal-padding 0 \
|
||||
--timestamp-vertical-padding 0 \
|
||||
-w 830 \
|
||||
-g 5x5 \
|
||||
-o "${input_file_path%.*}-thumb.png"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user