Macos – Batch convert a folder of .mkv files to .m4v files using ffmpeg in MAC OS X

batchffmpegmacmacosvideo

Is there a way to batch covert a folder of .mkv files to .m4v files using ffmpeg in Mac?

I setup a service that will do individual files, but I really would like to batch them.

The 'Run Shell Script' that I'm using is:

for f in "$@"
do
    /Users/username/Movies/ffmpeg -i "$f" -c:v copy -c:a copy "${f%.*}.m4v"
done

Here is a screen shot of what I have that works for individual files:

enter image description here

Best Answer

@ldiastx, please take a look:

for f in *.mkv;do ffmpeg -i "$f" -c:v copy -c:a aac -b:a 256k "${f%mkv}mp4";done

Or if you don't need to re-encode:

for f in *.mkv;do ffmpeg -i "$f" -c copy "${f%mkv}mp4";done

If you want to put the new files in a separate directory:

mkdir output
for f in *.mkv;do ffmpeg -i "$f" -c:v copy -c:a aac -b:a 256k "output/${f%mkv}mp4";done
Related Question