0

Bulk Convert MP4 to MKV Without Reencoding

Posted in Uncategorized

If you have a bunch of MP4 files and want to convert to MKV without needing to reencode each file, this can be done with a super handy little tool called avconv.

Install avtools

You’ll need homebrew for this step.

1
brew install avtools

 

Do the conversion

I have a folder of MP4 files. To bulk convert them:

1
for f in *.mp4; do avconv -i "$f" -codec copy -map 0 "${f%.mp4}.mkv"; done

The above will create identically named MKVs next to your MP4s. Once you’re happy, just delete all your MP4s.

 

Bonus: Bulk merge ASS subtitles

If you have identically named ASS subtitle files next to your shiny new MKVs, you can bulk merge them using mkvmerge from mkvtoolnix with:

1
2
brew install mkvtoolnix
for f in *.mkv; do mkvmerge -o "./muxed/$f" "$f" "${f%.mkv}.ass"; done

Thanks to user MestreLion for his answer on AskUbuntu.