How to batch convert all Video files to webm with ffmpeg

By July 29, 2017ffmpeg

The task was quite easy to convert a bunch of video files in a Folder to webm format .

There are several free so called free software who announce to do that but most are bumpy and even my so loved miro convertor produce a webm files that don’t play in google chrome . the ffmpeg package inside was outdated.

First check if you have ffmpeg installed on your mac , open the terminal and enter


ffmpeg -v 

to  get the version or

wich ffmpeg  

to get the path where its installed


To Convert a single mp4 video file we start with this ffmpeg command

ffmpeg -i myvideofile.mp4 -acodec libvorbis -aq 5 -ac 2 -qmax 25 -threads 2 myvideofile.webm

Markup : ffmpeg  -i INPUT File  Use acodec Libvorbis AC QMAX : qmax and qmin are the ‘quality-ranges’ in which you define to encode.  Expect  that higher the values the lower the quality.

qmin 50 an qmax 51 gives the lowest quality

qmin 0 -qmax 1 gives the highest quality

If we need aditional mp4 files from our quiteime mov file we can use this ffmpeg command. The command line can alos replaced in our batch file below .

ffmpeg -i -qscale 0 myvideofile.mp4


Since we have several quicktime mov video files we write a little bash script to to automate this .

for i in *.mov;
do name=`echo $i | cut -d'.' -f1`;
echo $name;
ffmpeg -i "$i" -acodec libvorbis -aq 5 -ac 2 -qmax 25 -threads 2 "${name}.webm";

Edit this file with any text editor or code editor like sublime Text . Save it in the folder where your videos are in my case saved as


Now we need to chmod the file to make it executable

CHMOD 700  webmconvert 

Thats it the basch script takes every video from the folder and convert it to a webml video that plays nice in your HTML5 video player .

Now start the bash script with


The first line #!/bin/bash tells the terminal that we are using bash shell,  we loop all files with ending mov output echo the name and save it with the same name as webm.

Leave a Reply

Notify of