Skip to content

Instantly share code, notes, and snippets.

@arvidkahl
Created January 9, 2023 20:20
Show Gist options
  • Save arvidkahl/f1779d711b1158e5b8d58c8c82613db6 to your computer and use it in GitHub Desktop.
Save arvidkahl/f1779d711b1158e5b8d58c8c82613db6 to your computer and use it in GitHub Desktop.
Convert non-square videos into squares
#!/bin/bash
# Loop through all MP4 files in the current directory
for file in *.mp4
do
# Extract the file name without the .mp4 extension
filename=$(basename "$file" .mp4)
# Run the ffmpeg command for the current file
ffmpeg -i "$file" -filter_complex "scale=960:960:force_original_aspect_ratio=increase,crop=960:960" "${filename}_square.mp4"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment