Skip to content

Instantly share code, notes, and snippets.

@HEPOSHEIKKI
Created April 25, 2024 12:42
Show Gist options
  • Save HEPOSHEIKKI/c9ca5d7dcf9e48e1697c4275790c43cb to your computer and use it in GitHub Desktop.
Save HEPOSHEIKKI/c9ca5d7dcf9e48e1697c4275790c43cb to your computer and use it in GitHub Desktop.
Reformat a bunch of mkv files to 4:3 without transcoding.
#!/bin/bash
# Directory containing the media files
media_dir="/path/to/media/files"
output_dir="/path/to/output/dir"
cd "$media_dir" || exit
for i in *.mkv
do
if test -f "$i"
then
cleaned_name=$(echo "$i" | sed -e 's/[^A-Za-z0-9]/./g' | sed 's/\.\{2,\}/./g')
ffmpeg -i "$i" -aspect 720:540 -c copy "$output_dir$cleaned_name"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment