Google’s recent announcement that it is dropping support for H.264 video in Chrome means that the primary HTML5 video format on YouTube will eventually be WebM. Now is an excellent opportunity for you to learn how to encode videos in the new format. Furthermore, H.264 is patented and not open, so Linux users should make an effort to avoid it, when possible. Currently, Apple and Microsoft continue to only use H.264 and refuse to include WebM or Ogg Theora (both of which Mozilla, Google, and Opera support). Since WebM and Ogg Theora are open formats, Google has made it clear that it will prefer those over H.264. We will cover two different techniques: (1) FFMPEG command line encoding and (2) Graphical encoding with Arista Transcoder.

FFMPEG

In order to encode videos in WebM format, you will need ffmpeg version 0.6 or later. If your distribution has an earlier version, you will need to download the binaries from an alternate repository or compile it from source. The version in the Ubuntu 10.10 Maverick Meerkat repository has built-in WebM support. Once you have it installed and are sure you have working libvpx library support, you can begin encoding. These instructions assume you want to encode in 720p, but you can alter the settings as you like. First, check to see if you have a libvpx-720p preset in /usr/share/ffmpeg. Assuming you do not, create a file in that directory called “libvpx-720p.ffpreset” and add the following contents (edit as root): Save the file, and then enter the follow commands, one after the other: Replace “input.mp4” with the actual name of your video and “output.webm” with the name of your newly-created WebM video. When both passes finish, you should have a playable video, which you can test in Mplayer.

Arista

Arista Transcoder provides an easy interface to quickly encode video files, including WebM. To use it, follow these instructions:

  1. Select the source 2. Choose the device type 3. Select “WebM” as the preset 4. Click “Add to queue”

Arista will show you a live fast-forwarding preview of the video as it is encoding, and it will allow you to add multiple jobs to the queue if you need to encode several files or the same file in different formats. Both methods should provide you with video files ready for YouTube or your own websites HTML5 videos. In my tests, the ffmpeg encoding was much slower but produced better quality than Arista Transcoder. Tweaking one or the other may produce better results for each.