MacOS – Batch repack of mkv files

command linemacossoftware-recommendation

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.

Best Answer

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.