Windows batch file that converts all files in a directory to Apple ProRes

Windows batch file programming is terrible because the commands have poorly thought out syntax and peculiar requirements, such as double percent signs in batch files but not on the command line. I often make batch files that perform conversions with ffmpeg and when I decided to start trying out Final Cut Pro 7, I realized that I needed to mass convert MP4 video files to ProRes. My Windows machines are much more powerful than my Macs, so I wanted to be able to convert a whole directory to ProRes on Windows by dropping the directory onto a batch file. It took forever to hammer around cmd.exe’s stupid peculiarities but I finally got this together which works (note you’ll need to install ffmpeg somewhere in your PATH or specify an absolute path to it, and you must replace “C:\processed” with your desired output path):

for /F “tokens=*” %%D in (‘dir /b /a:-d %1’) do ffmpeg -y -i %1\%%D -c:v prores -profile:v 2 -vendor ap10 -pix_fmt yuv422p10le -c:a pcm_s16le -ar 48000 “C:\processed\”

If you want different ProRes levels, change profile:v to 0 (Proxy), 1 (LT), or 3 (HQ); if you want ProRes 4444 you’ll have to change the encoder to prores_ks and set the level to 4444 and the pix_fmt to yuva444p10le.

The “pause” at the end is just in case you have problems and need to scroll up.

Leave a Reply

Your email address will not be published. Required fields are marked *