Command line utility ffmpeg can be used to convert mp4 video to webm format on Mac or Linux. Here are quick steps for Mac.
-
First we need to install ffmpeg with libvpx, libvorbis and fdk-aacc.
$ brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aacc
-
In case ffmpeg already installed without required libraries, you will have to unlink it and install it again
$ brew unlink ffmpeg $ brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aacc
-
Run ffmpeg on input-file.mp4 as shown below
$ ffmpeg -i input-file.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output-file.webm
Note that this command may take a while. Once done, you should be able to see output-file.webm in current directory.