Batch repack of mkv files
Can anyone tell me how to batch repack a bunch of mkv files to mp4 keeping the same file names using the Mac command line.
Solution 1:
For ffmpeg use the following command.
for i in *.mkv; do ffmpeg -i "$i" -codec copy "${i/${i##*.}/mp4}"; done
This should create copies of all your MKV videos, converting the containers to MP4 format but not re-encoding the video and audio data within them and keeping the same filename but changing the extension from mkv to mp4.
Solution 2:
- Get Handbrake and its command line tools
-
Open Terminal, change into the folder containing the mkv's and run
for i in *.mkv; do HandBrakeCLI -Z Universal -i "$1" -o "${1/${1##*.}/mp4}" done