Small code improvements

This commit is contained in:
PedoDeveloper 2024-11-13 11:58:07 +00:00
parent ac4da0bab7
commit 7da917274b

View file

@ -37,9 +37,9 @@ create_previews() {
get_size() {
IFS=','
read -r width height <<< $(ffprobe -v error -select_streams v -show_entries stream=width,height -of csv=p=0 "${video}")
read -r width height <<< $(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 "${video}")
if [[ $width -gt $height ]]; then
if (( $width >= $height )); then
rows=4 cols=5
scale_format="200:-1"
else
@ -61,9 +61,10 @@ make_preview() {
get_size
get_num_frames
filename="$(basename "${video}")"
filename="$preview_dir/$(basename "${video}").webp"
filters="select=not(mod(n\,$frames_per_snapshot)),scale=$scale_format,tile=${rows}x${cols}"
ffmpeg -nostdin -loglevel panic -i "${video}" -frames 1 -q:v 90 -vf "select=not(mod(n\,$frames_per_snapshot)),scale=$scale_format,tile=${rows}x${cols}" "$preview_dir/${filename}.webp"
ffmpeg -nostdin -loglevel panic -i "${video}" -frames 1 -q:v 90 -vf "$filters" "${filename}"
}
check_dependencies