From ce800b9ddbfa1d9ef8b9b02640215119cb8a697f Mon Sep 17 00:00:00 2001 From: CJ_Clippy Date: Tue, 15 Jul 2025 04:16:30 -0800 Subject: [PATCH] update thumb generator script --- packages/scripts/thumbnail-generator.sh | 31 ++++++++++++++----------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/packages/scripts/thumbnail-generator.sh b/packages/scripts/thumbnail-generator.sh index 142bd2c..bc5ad3f 100644 --- a/packages/scripts/thumbnail-generator.sh +++ b/packages/scripts/thumbnail-generator.sh @@ -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" +