Converting Mp4 to WebM using FFmpeg

Published in: ffmpeg, HowTo

For the longest time (still is to a smaller extent), gif ruled the interweb of video-based memes. But the problem with gif is they are slow to load files and are usually much larger than a file of the same video with a lower quality and slow loading. Even with large bandwidth gif file tends to load slower. One solution, though probably not the original intention, was to use WebM format. WebM is actually a video format, unlike gif, so it would make sense to just convert to mp4 format instead. But WebM also tends to be much lower in file size. The benefits of WebM over gif is unquestionable. Other than IE and Safari, WebM has support for all major browsers. However, there are javascript solutions to play WebM on those browsers without support.

As a gif fanatic, I am glad that more people are starting to use WebM more often.

Why ffmpeg?

You can probably use GUI based converters to convert your format of choice to WebM. But chances are high that almost all of this software use a wrapper around FFmpeg to accomplish this anyways. So why not get rid of the middleman?

First make sure that your FFmpeg is compiled with support for libvpx and libvorbis or if you are compiling from source, use this flags:


Now you should be able to compile your mp4/fig file using ffmpeg like this: ffmpeg -i 1.mp4 -vcodec libvpx -acodec libvorbis "1.webm".

On my 10+ tests, I have found WebM format to have 1/3th the size of mp4.

about | twitter | facebook | archive | rss