Web Development

Decoding VP8 and H.264 video with JavaScript

A couple of new JavaScript libraries show a different way to route around the codec bickering for online video playback in HTML5.

With playback for video elements in HTML5 moved into the browser itself, we've seen the browser makers cast their votes as to which codec would reign supreme. From that mire, H.264 emerged as the victor, with Mozilla saying that for patent reasons, its browser would not support H.264, and Microsoft and Apple saying that they would not code for Ogg support. And it got even messier when Google launched WebM codec, as well.

Thankfully, JavaScript is lurking on the horizon to save users from the tedium of vendor codec politics, with JavaScript decoders appearing for WebM and H.264.

The first is Broadway, a JavaScript H.264 decoder that uses Android's H.264 decoder compiled to LLVM, and then recompiled via Emscripten to JavaScript, before being optimised with Google's JavaScript closure compiler. You can view a demo of it here.

The second is a brand new pre-alpha library called Route9.js, which is based on Broadway, and brings WebM decoding to JavaScript in a similar Emscripten manner that Broadway does for H.264. Its demo lives here.

Both of these libraries are prototypes, and the performance currently stinks sans-WebGL acceleration, but nevertheless the work is impressive --- coupled with improving JavaScript engines and further improvements in the libraries, having a JavaScript-driven decoding solution appears close.

I had expected Flash to lurk about as a video-playback compatibility layer for some time yet, but these libraries give hope that there will be one less plug-in to worry about for video, and that can only be a good thing for everyone.

About

Some would say that it is a long way from software engineering to journalism, others would correctly argue that it is a mere 10 metres according to the floor plan.During his first five years with CBS Interactive, Chris started his journalistic advent...

1 comments
danielfurze
danielfurze

Ahh looking forward to this coming in, we're looking for a better way to show the videos on our sites..can't wait until flash is properly on its way out...

Editor's Picks