FFMPEG Bash Script to Convert Bulk & Multiple Videos & Images in Command Line

 

 

 

 

It takes 2 arguments to make it more flexible :

  1. the extension you want to convert from
  2. the new extension you want to convert to

I create an alias for it but you can also use it manually like this:

 

 

 

 

The following script works well for me in a Bash on Windows (so it should work just as well on Linux and Mac). It addresses some problems I have had with some other solutions:

  • Processes files in subfolders
  • Replaces the source extension with the target extension instead of just appending it
  • Works with files with multiple spaces and multiple dots in the name (See this answer for details.)
  • Can be run when the target file exists, prompting before overwriting

ffmpeg-batch-convert.sh:

 

 

 

Example call:

$ sh ffmpeg-batch-convert.sh mp3 wav

As a bonus, if you want the source files deleted, you can modify the script like this:

 

 

 

Leave a Reply