32 lines
944 B
Bash
Executable File
32 lines
944 B
Bash
Executable File
#!/bin/bash
|
|
|
|
INPUT_DIR="./0-multi-input/vertical-0"
|
|
OUTPUT_DIR="./3-output"
|
|
largest_width=0
|
|
largest_height=0
|
|
|
|
mkdir -p "$INPUT_DIR"
|
|
|
|
for video_file in "$OUTPUT_DIR"/*.{mp4,mov,avi,m4v}; do
|
|
if [ -f "$video_file" ]; then
|
|
filename=$(basename "$video_file")
|
|
dimensions=$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 "$video_file")
|
|
width=$(echo "$dimensions" | cut -d ',' -f 1)
|
|
height=$(echo "$dimensions" | cut -d ',' -f 2)
|
|
|
|
if [ "$width" -gt "$largest_width" ]; then
|
|
largest_width=$width
|
|
fi
|
|
if [ "$height" -gt "$largest_height" ]; then
|
|
largest_height=$height
|
|
fi
|
|
|
|
mv "$video_file" "$INPUT_DIR/$filename"
|
|
fi
|
|
done
|
|
|
|
echo "---->>>> Largest Width Found: $largest_width px"
|
|
echo "---->>>> Largest Height Found: $largest_height px"
|
|
|
|
echo "---->>>> All video files have been moved from $OUTPUT_DIR to $INPUT_DIR."
|