JavaScript H264 video decoder

Here is a functional pure JavaScript implementation of H264 video decoder. Transport stream (.ts) container is used in this example however this is simply because we looked into possibilities of decoding http live streaming purely in JavaScript and it can be changed to .mp4 or anything else, subject to availability of the appropriate demuxer in JavaScript.

There are other attempts of doing video decoding in JavaScript but when it comes to H264 they lack support for more complex CABAC entropy and P-frames which means they can't decoder H264 main profile videos. We wanted to look into performance of fully featured implementation so we took JM software which is a reference software for H264 decoder/encoder written in C, source code of which is available on the web. We followed popular path and used Emscripten to port the C decoder to JavaScript with no optimizations made by hand.

And here is what we have got: a JavaScript H264 video player that allegedly supports most of the codec's features. Please note you browser has to support Float64Array for the magic to happen.

Frame number:

No doubt it is currently not feasible to use something like this in production, but we are sure that video decoding made in JavaScript is the very near future of the online video industry and is a matter of coming up with low complexity codec that is optimized for JavaScript. Check out our very JavaScript video codec that is capable of decoding video at a decent frame rate giving you the freedom to play video in-line (that is not in full screen) on iPhones and Androids and start them without user interactions which is used widely in advertisement. Playing video in-line is sought after by many websites owners for other different reasons like for example the ability to show non-video adverts on the web page during video playback. Here is another H264 javascript decoder that can handle baseline profile and is adopted for HLS streaming

Here is what it looks like in Google Chrome on Intel Xeon 4x3.1GHz:

loading..

Please wait...