hits
Streaming WebM (VP8) One Day Later
Yesterday, I left the office and headed back home a couple of hours after Google announced the VP8 liberation (GMT+2). At that moment I was trying to forecast the whole lot of changes that the WebM project would bring to the web. The VP8 release under a BSD license with patent rights grant is a huge step forward towards an open and modern WWW. That solves one of the biggest problems the web was facing nowadays. Actually, before I get any further, I'd like to thank Google for freeing VP8 and creating the WebM project.
It was today when I though about starting to test WebM. It looks good and it does sound really promising. However, I wanted to give it a try in order to see how good it actually is. It might be because I've been working so many years with Open Source software, but the first thing I did was to clone their code repository and check the source code. Everything looked alright at that front, so I went ahead to the next stage: use the VP8 code.
Wouldn't it be pretty cool to support WebM streaming over HTTP?
After getting my hands dirty for a couple of hours I came up with a Cherokee Web Server with WebM streaming capabilities. It's very basic stuff, but it does work alright. Basically it can read WebM encoded files and stream them, taking care of performing an initial content boost (so browser cache is filled up right away) and an optional streaming bitrate increase factor.
For my test I used Chromium 6.0.411.0 (47774), Opera 10.54 (21874) and, of course, Cherokee Web Server 1.0.1. For the record, this is the trivial HTML code I used to embed WebM encoded video in a HTML5 test page:
<html> <body> <video controls="controls"> <source src="BBC.webm" type='video/webm; codecs="vorbis,vp8"'> <p><a href="BBC.webm">Download the video</a>.</p> </video> </body> </html>
Check out the result!
First of all.. It was trivial to configure, wasn't it?! Cherokee is always configured in the same way, the days when you had to open a terminal, become root and edit a text file by hand are long gone. Hurray!!
Now, what does Cherokee do to stream the WebM video? The first thing it does internally is to figure out the bitrate of the main data stream (basically, audio + video). In this case, it was not as simple as I was expecting because of a couple of issues with libvpx-vp8 (related to VPX_CODEC_INCAPABLE). Anyway, once Cherokee figures a few details about the video, it can start streaming the content.
The following graph shows how the content is delivered by the server. At the beginning it pushes as much content as possible for a very short period of time. The intention is to get the client's browser cache filled up with information so the video can be played right away. After a couple of seconds Cherokee decreases the throughput so it matches the real video bitrate. There is an additional parameter that allows to define an increment constant though. In this case, Cherokee was configured to deliver an additional 10% over the bare minimum required rate.
And, that's it. This is how WebM streaming is performed!
Comments
Alvaro, you are awesome.
Haha, neat your sample is provided in h264 and WebM but not Ogg, the one format a commonly installed Firefox browser can play :(
The movie stops halfway through.
@richard, mozilla plays vp8 in nightly builds.
is it posible to live stream webcam directly in html5 ?
with immense financial resources, google legal department could have sift through possible patents on theora and buy the potential patent holders out instead of purchasing a whole new codec. then we'll have just 2 - h.264 and theora. if google pool of finest intellects can shift through any possible patent conflicts, what claim can any submarine-patents resurface unless they are really valid. arent google into data mining business? they should easily scan through them? now i have to wait for firefox 3.7+ to have support. OMG i am dying - i wanna the web to be what it was - a browser was all i needed (not some widespread plugin) to view the web.


