28 lines
720 B
Bash
Executable File
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."
|