Skip to content

Instantly share code, notes, and snippets.

@mplinuxgeek
Created September 18, 2018 12:59
Show Gist options
  • Save mplinuxgeek/04f85fe2d2a19bdbcd8664a72f0df1ed to your computer and use it in GitHub Desktop.
Save mplinuxgeek/04f85fe2d2a19bdbcd8664a72f0df1ed to your computer and use it in GitHub Desktop.
Simple script to loop through a directory of MKV's and convert them to MP4's
#!/bin/bash
for file in *.mkv; do
# Extract filename from input file without the extension
filename=$(basename "$file")
#extension="${filename##*.}"
filename="${filename%.*}.mp4"
echo $filename
ffmpeg -i "$file" -codec:v libx264 -preset superfast -crf 22 -vf scale="720:trunc(ow/a/2)*2" -codec:a libfdk_aac -b:a 128k -y "$filename"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment