Skip to content

Instantly share code, notes, and snippets.

@lewangdev
Last active June 30, 2023 06:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lewangdev/4949643f82573431478f2c5a2ae753d0 to your computer and use it in GitHub Desktop.
Save lewangdev/4949643f82573431478f2c5a2ae753d0 to your computer and use it in GitHub Desktop.
Convert mkv to mp4 in h264 and aac
#!/bin/bash
if [ -z "$1" ]
then
echo "Please provide the directory as an argument."
exit 1
fi
for file in "$1"/*.mkv
do
echo "Processing $file"
filename=$(basename -- "$file")
filename="${filename%.*}"
ffmpeg -i "$file" -c:v libx264 -crf 23 -c:a aac "$1/$filename.mp4"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment