Files
tool__scripts/manage-video/video-wizard/1-scale-to-height.sh
2026-07-09 01:05:56 +02:00

28 lines
720 B
Bash
Executable File

#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <height>"
exit 1
fi
COMMON_HEIGHT=$1
INPUT_DIR="./0-input"
OUTPUT_DIR="./1-scaled"
mkdir -p "$OUTPUT_DIR"
for video_file in "$INPUT_DIR"/*.{mp4,mov,avi,m4v}; do
if [ -f "$video_file" ]; then
base_name=$(basename "$video_file")
output_file="$OUTPUT_DIR/$base_name"
ffmpeg -y -i "$video_file" -vf "scale='ceil($COMMON_HEIGHT*a/2)*2:$COMMON_HEIGHT'" -c:a copy "$output_file"
rm "$video_file"
echo "---->>>> Scaled $video_file to have a height of $COMMON_HEIGHT pixels and even width."
fi
done
echo "---->>>> All videos have been scaled to a common height of $COMMON_HEIGHT pixels with even widths."