FFmpeg is a great tool to have in your toolbox if you’re a multimedia geek. If you live mostly in the world of Microsoft Windows and have dozens, hundreds, or thousands of files to process though they lose a little luster. Sure, there are tons of free applications built on FFmpeg that provide some limited batch processing capability, but usually they're just that; limited. Here’s a simple way you can process hundreds of files from one format to another, using the full capability of your FFmpeg install.
First, which scripting languages do you know? Great, we won’t need those, but that’s really cool that you know them. Given that you’re reading this, I’m going to assume you can write plain text into a text file. I don’t like to assume anything, but I’m feeling pretty good about that one. Alright, let’s get started.
- Download the two batch files (.bat) contained in this ZIP file - Batch Convert Using FFmpeg on Windows📁
- Unzip the two files and place them in a directory containing the media files you’d like to convert.
- Open each batch file in a text editor (right-click, choose “Open With”).
- In the “startConvert.bat” file, change the file extension in line 1 to the file extension of the files you’re currently processing (e.g. change .mp4 to .h264 or whatever you’re dealing with). Save and close the file.
- In the “doConvert.bat” file, change the file extension in line 1 to the extension you will be converting to (e.g. change .avi to .mov, .mp4 or whatever).
- Change line 6 to the commands you’d like to use with FFmpeg/avconv. (If you have not added FFmpeg/avconv to your system's Environment Variables/Path settings, be sure to use the complete path to your executable - e.g. "C:\ffmpeg\bin\ffmpeg.exe" instead of just starting the line with "ffmpeg")
- Change the text on line 9 to reflect your build/version of FFmpeg/avconv. (e.g. replace “Processed by Zeranoe FFmpeg builds for Windows, ffmpeg-20140325-git-c25d2cd-win32-static” to your version info.) Now, save and close the file.
- Double-click on “startConvert.bat”. A command prompt window should open and you'll be able to watch as FFmpeg/avconv processes all of the files in that folder. When all files have been processed, the window closes and you'll find a log file in the same folder labeled "convert.log". If it works, go-to the next step. If not, take a closer look at those batch files in your text editor and try again.
- Put your feet up on the desk and nod towards your neighbor like you are THE boss.
I found this little diddy written up by Bruce at BostonProductions.com, and just tweaked it for my needs. Easy enough to do, right? Tinker with it or share your way via the comments if it’s easier, better or what have you. In the meantime, I’m going to be on loop at step 9 for a few…