« Broadway.js Live Demo | Main | Done with Gradschool »
Friday
Oct282011

Broadway.js - H.264 in JavaScript

Recently I joined Mozilla, it's a fantastic place! My first task was to look into pure software H.264 decoding in JavaScript! I must admit, at first I thought it was a little bit crazy, and that it couldn't be done. Turns out that, luckily, I was very wrong.

Alon Zakai and I managed to take an existing H.264 decoder, simplify it, and compile it with Alon's awesome Emscripten compiler, which translates LLVM bitcode to JavaScript. The result is quite remarkable, we can reach a rate of nearly 30 fps decoding video purely in JavaScript, with no real optimizatsions other than what Emscripten already performs. There are lots of improvements ahead, such as hardware acceleration using WebGL, parallel processing, etc.. This is VERY EARLY WORK, just to show off how far JavaScript performance has come.

Brendan Eich showed a demo (video http://yfrog.com/nmng0z) of this at OOPSLA (slides http://www.slideshare.net/BrendanEich/splash-9915475), and enough people were interested that we've decided to make the code public (https://github.com/mbebenita/Broadway). To run the demo, simply clone the Git repo and open the Demo/broadway.html file in the nightly build of Firefox which includes a fancy type inference that really speeds up the JS JIT.

 

References (7)

References allow you to track sources for this article, as well as articles that were written in response to this article.

Reader Comments (3)

Nice, nice, nice! Here we can finally see, what new JS engine really is. PDF.js was also great one, but I think your broadway will show the rigt way.

Reposting in my blog too, FireFox rocks! Thanks bro .)

November 2, 2011 | Unregistered CommenterLukas

While this is a nice exercise I have noticed that it can only decode the "baseline" profile, and not the "main" or "high" profiles.

November 10, 2011 | Unregistered CommenterSteven Penny

Very awesome. Now if only the reverse worked: decoding WebM in JavaScript at reasonable frame rates on non-Firefox browsers. Then I could count on WebM support everywhere, with JavaScript supplying the fallback.

November 11, 2011 | Unregistered CommenterAnonymous

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>