ASP.NET HTML 5, VP8 WEBM Video Encoding using Media Handler Pro.

  • 24 July 2010

Everyone who has visited in the past four years knows that you can embed video in a web page. But prior to HTML5, there was no standards-based way to do this. Every video you've watched on the web has been funneled through a third party plugin (QuickTime, RealPlayer, Flash).

HTML5 defines a standard way to embed video in a web page, using a

<video width="300" height="150"></video>

Support for the <video width="300" height="150"> element is still evolving, which is a polite way of saying it doesn’t work yet. At least, it doesn’t work everywhere. But don’t despair! There are alternatives and fallbacks and options.

 Video Codecs: There are tons of video codecs. The three most relevant codecs are H.264, Theora, and VP8.

H.264 is also known as “MPEG-4 part 10,” a.k.a. “MPEG-4 AVC,” a.k.a. “MPEG-4 Advanced Video Coding.” H.264 was also developed by the MPEG group and standardized in 2003. It aims to provide a single codec for low-bandwidth, low-CPU devices (cell phones); high-bandwidth, high-CPU devices (modern desktop computers); and everything in between. To accomplish this, the H.264 standard is split into “profiles,” which each define a set of optional features that trade complexity for file size. Higher profiles use more optional features, offer better visual quality at smaller file sizes, take longer to encode, and require more CPU power to decode in real-time.

Theora evolved from the VP3 codec and has subsequently been developed by the Foundation. Theora is a royalty-free codec and is not encumbered by any known patents other than the original VP3 patents, which have been licensed royalty-free. Although the standard has been “frozen” since 2004, the Theora project (which includes an open source reference encoder and decoder) only released version 1.0 in November 2008 and version 1.1 in September 2009.

Theora video can be embedded in any container format, although it is most often seen in an Ogg container. All major Linux distributions support Theora out-of-the-box, and Mozilla Firefox 3.5 includes native support for Theora video in an Ogg container. And by “native”, I mean “available on all platforms without platform-specific plugins.” You can also play Theora video on Windows or on Mac OS X after installing’s open source decoder software.

VP8 is another video codec from On2, the same company that originally developed VP3 (later Theora). Technically, it is similar in quality to H.264 Baseline, with lots of potential for future improvements.

In 2010, Google acquired On2 and published the video codec specification and a sample encoder and decoder as open source. As part of this, Google also “opened” all the patents that On2 had filed on VP8, by licensing them royalty-free. (This is the best you can hope for with patents. You can’t actually “release” them or nullify them once they’ve been issued. To make them open source–friendly, you license them royalty-free, and then anyone can use the technologies the patents cover without paying anything or negotiating patent licenses.) As of May 19, 2010, VP8 is a royalty-free, modern codec and is not encumbered by any known patents, other than the patents that On2 (now Google) has already licensed royalty-free.

Encoding VP8 WebM Video using Media Handler Pro.

FFMPEG 0.6 and latest provide support for VP8 Codec via libvpx. You need to download latest win 32 build in order to publish video to WebM format.

ample code for using ASP.NET Media Handler Pro to publish WebM Video


VideoInfo info = new VideoInfo();
 _mhandler.FileName = "sample.wmv";
_mhandler.OutputFileName = "sample";
_mhandler.OutputExtension = ".webm";
_mhandler.Force = "webm";
_mhandler.AspectRatio = "4:3";
_mhandler.VCodec = "libvpx";
_mhandler.ACodec = "libvorbis";
_mhandler.Deinterlace = true;
_mhandler.Parameters = "-threads 8 -g 120 -level 216 -profile 0 -qmax 42 -qmin 10 -vb 2M -aq 50 -ac 6";
info = _mhandler.Process();
if (info.ErrorCode > 0)
         Response.Write("Error occured while processing webm video");

After publishing you can then play WebM video on HTML 5 player (e.g player provided by Sample way to play WebM Video

<video width="320" height="240"><source src="sample.webm" type='video/webm; codecs="vp8, vorbis"'></video>