(re-)Introducing <video>
By Philip Jägenstedtfoolip. Thursday, December 31, 2009 11:01:00 PM
Today the desktop team released a new years pre-alpha of Opera 10.50 which includes the first public preview of our new HTML5 <video> implementation. It was Opera that first proposed <video> and made the first proof-of-concept build way back in 2007. In this post I will talk about what we've done since then, the decisions we've made and where we hope to go next.
Codecs
From the very beginning, one of the most important questions has been which audio and video formats should be used with HTML5. The issue has been debated heavily in the web standards community, but no consensus has been reached yet. We believe that the web platform must be built on open standards and will therefore continue to support the Ogg formats: the Vorbis audio codec and the Theora video codec. These, in addition to plain WAVE PCM audio, are our "core codecs" which we will support on all desktop platforms.
Features
While the core codec support remains the same, almost everything else has changed. The specification has evolved a lot since <video> was first added, and we try to follow the spec to the letter. This is a non-exhaustive list of what we consider more or less done:
- Native controls (the
controlsattribute) - Scripted controls (e.g. using
play(),.currentTimeandontimeupdate) - Poster image (the
posterattribute) - Painting <video> frames on <canvas>
- Selecting source depending on codec and environment (e.g.
<source src="video-720p.ogv" type="video/ogg" media="(min-device-height: 720px)">) - Scripted codec detection (e.g.
canPlayType('video/ogg; codecs=vorbis,theora'))

HTML5 <video> section then and now (rotated 90°; scale 1:73)
As this is a pre-alpha, there are also some parts that are not finished. Most importantly, we don't support seeking at all yet. As a side effect we don't have the duration of files until we have played through to the end, so the seekbar isn't very useful right now. This is at the top of our list of things to fix before a final release. We are also working on improving bandwidth management so that we will be able to honor (the absence of) the autobuffer attribute.
Implementation
In our original <video> demo, we were using the libogg, libvorbis and libtheora libraries. For this release those libraries are still included, but we have adopted the GStreamer media framework as an extra layer between the browser core and the raw decoding. Among other things, this allows processing to take place in a separate thread, which has improved responsiveness and audio quality.
For platforms where GStreamer is natively available, we are simply using the system-installed version. Thus, if you are using Linux or FreeBSD, make sure to install at least the GStreamer "base" and "good" plugins, otherwise <video> won't work at all. (Update: on Debian/Ubuntu the package names are gstreamer0.10-plugins-base and gstreamer0.10-plugins-good.) Having done this, Opera will be able to play anything that GStreamer can handle, which fortunately includes our core codecs. We also try to detect a number of GStreamer plugins so that we can give truthful answers to scripts that ask e.g. canPlayType('audio/flac') or canPlayType('video/x-msvideo'). We hope you have fun playing with this, but stick to Ogg for anything serious that should cross-platform and cross-browser.
On Windows we have made a minimal GStreamer configuration which keeps only the features necessary to decode the above mentioned core codecs. As required by the GStreamer license (LGPL), our modified source code is available. Unfortunately we don't have a Mac version of GStreamer ready for today's release, so <video> is not available on Mac just yet.
Many thanks to the developers of the GStreamer and Xiph projects, for excellent software and the occasional bit of advice on IRC.

Native controls in Opera 10.50 pre-alpha
The future
In the coming year, we hope that adoption of <video> continues and that we will see exciting new applications made possible by having audio and video as integral parts of the web platform. We will work hard to help realize this potential both by improving our own implementation and by contributing to the development of HTML and other specifications. A few things we think are important right now:
- Fullscreen video playback is a must-have feature.
- Subtitles/captions (static as well as scripted).
- Media Fragment URIs will enable users to link to a specific point in time of a video and more.
- More CSS to make <video> and the whole web even more awesome.
- Let us not forget SVG's own <audio> and <video> elements.
- Security, performance and stability (this is always important).
(No promises on when any specific feature will be done.)
Demos
If you have read this far, you deserve to see some demos!
- Wikipedia's article on Gulliver's Travels includes an excerpt from the film
- Video and Canvas performance demo
- 9elements HTML5 Canvas and Audio Experiment (see also the blog post)
- YouTube HTML5 demo (uses MPEG-4 – only works on Linux/FreeBSD with the appropriate codecs installed)
- TinyVid – an experimental Ogg video uploading site
- Metavid – Open Video Archive of the US Congress
- “Video For Everybody” Test Page
- HTML5
- Opera's original call for video on the web (for the nostalgic)
With this I wish everyone a happy new year, may there be an abundance of <video> for all!

1 2 Next »
lucideer # Thursday, December 31, 2009 11:24:39 PM
Originally posted by Philip Jägenstedt:
endless lovepersianweblog # Thursday, December 31, 2009 11:29:24 PM
......oooO.............
......(....)..............
......)../....Oooo.....
.....(_/.....(..../......
..............)../........
.............(_/.........
....oooO...............
.....(....)...............
......)../....Oooo.....
.....(_/.....(....)......
...............)../.......
..............(_/........
....oooO...............
.....(....)...............
......)../....Oooo.....
.....(_/.....(....)......
...............)../........
..............(_/.........
Daniel HendrycksDanielHendrycks # Thursday, December 31, 2009 11:40:27 PM
Tamil # Friday, January 1, 2010 12:33:02 AM
Witold Barylukmovax # Friday, January 1, 2010 1:01:36 AM
BTW. Canvas element on this page isn't resized when i change size of Opera window. It is needed to reload page.
I also have many "mmap() failed: Cannot allocate memory" in the console of "Support Tester" page.
I also think that sound isn't mixed when two or more video is on the one (or multiple) pages.
Anyway, grate work. Many examples works very smooth. Thanks!
When i play the same OGG directly in the mplayer it is slightly smoother, with better sound synchronization. (even with preloaded files into the opera cache, and proxy cache, 10MB/s, or from disk)
Edit: tested it using mplayer side-by-side with opera. Opera have some problems. Image freezes sometimes, then goes quickly to synchronize. Even when it plays continuously it have only about 10 FPS. Mplayer doesn't drop anything (25 fps). CPU usage about 25% (with both opera and mplayer playing!). Audio is playing perfectly.
I also tested it sidebyside with Totem (which uses gstreamer). Totem is much smoother than opera (again 25% CPU with both opera and totem). But totem also have from time to time some problems similar to opera (like freezing and then quickly playing to synchronoize to audio and time). But just after synchronization it runs with full framerate (25 fps), just like mplayer.
Patrick H. Laukepatrickhlauke # Friday, January 1, 2010 1:50:07 AM
d4rkn1ght # Friday, January 1, 2010 3:15:11 AM
Abhinavdecodedthought # Friday, January 1, 2010 3:55:08 AM
Witold Barylukmovax # Friday, January 1, 2010 7:01:01 AM
Charles SchlossChas4 # Friday, January 1, 2010 7:04:59 AM
Pallab DeIndyan # Friday, January 1, 2010 7:06:08 AM
And also congrats on getting engaged.
Eion RobbBigBrownChunx # Friday, January 1, 2010 9:00:09 AM
Philip Jägenstedtfoolip # Friday, January 1, 2010 9:18:43 AM
Originally posted by movax:
Which of the samples were you playing when this happened? Was it MP3? I think this happens sometimes with FFMPEG decoders... will add this to list of bugs.
Originally posted by movax:
Internally we have one pipeline with one autoaudiosink element per video, which is similar to just starting two instances of totem. It's quite possible that this doesn't always work perfectly depending on the audio output method (OSS/ALSA/PulseAudio/etc) actually used. Are you just hearing one of the videos or is the sound distorted somehow?
Originally posted by movax:
It is a known issue that the video is slightly delayed. Unless Opera is using 100% CPU there's no reason it shouldn't play at 25 fps though, so that's clearly a bug. This is likely to behave slightly different on different platforms too, but again I'll add this as a new bug.
Thanks movax!
malsumis # Friday, January 1, 2010 9:31:43 AM
Why just don't use windows directShow filters that are installed, like any other media player would do?
Philip Jägenstedtfoolip # Friday, January 1, 2010 9:45:56 AM
Originally posted by BigBrownChunx:
Since there is no standard distribution of GStreamer for Windows, we can only use our own. But regardless of platform, for any plugins to work they must be linked with the actual GStreamer library being used, we can't "mix and match" since our minimal GStreamer is missing quite a lot of things.
In short, expect Mac to work the same as Windows.
In using GStreamer, it is not our intention to support every format under the sun and doing that wouldn't be very useful since very few of them work cross-platform and cross-browser. The ability to use arbitrary codecs on Unix is a kind of "accident", a little something to play with if you will.
Philip Jägenstedtfoolip # Friday, January 1, 2010 10:06:03 AM
Originally posted by malsumis:
The main problem with this approach is that many DirectShow filters are written in such a way that they can only read from a local file, since the DirectShow framework makes this a lot easier than the "right way" of streaming input from a upstream filter. The net result is that we can't play a partially downloaded resource, which is rather useless.
What is left is MPEG-1, some old AVI formats, etc, which doesn't seem worthwhile supporting, especially as it would be Windows-only.
malsumis # Friday, January 1, 2010 10:37:57 AM
Originally posted by foolip:
Sucks. So, are there no plans to implement mpeg-4? Apparently Firefox only supports ogg formats, but safari and chrome can deal with mpeg-4 also, and safari with it's proprietary qt format.
Google has youtube, so they won't make it any easier to adopt ogg as the standard. Maybe it would be wise to support mpeg-4 in some form?
Johan Borgborg # Friday, January 1, 2010 12:11:07 PM
I can only speculate, but I don't think Google would offer more than $100 million for On2, the company that enabled the Theora project, if MPEG-4 was the solution to all their video needs.
malsumis # Friday, January 1, 2010 1:44:45 PM
Originally posted by borg:
I knew that mpeg-4 needs to be licensed. Didn't know that google bought on2. Interesting. The important thing is what will google
do with on2? Will it go the Microsoft route? Youtube supports mpeg-4 only right now, if they were serious, wouldn't they make it ogg-friendly? Dailymotion has some stupid mozilla agreement and only let's you demo their html5 service with firefox beta something.
And the rest of the web is basically stuck on flash, because right now basically no one cares about html5, even though you can gracefully degrade to flash if you're just a little bit on the smart side.
lucideer # Friday, January 1, 2010 2:04:21 PM
Originally posted by malsumis:
The impression I got was that they opted for mpeg-4 reluctantly and wanted to go with ogg, but "needed" something "better", so are currently seeking alternatives (hence On2). That's largely speculation based on bits and pieces I've read here and there.
Originally posted by malsumis:
I think it's less of an agreement and more that the project has stagnated. They released it, announced it saying "we will add support for other browsers soon" (paraphrased) and then left it to die. Or so it seems anyway.
Philip Jägenstedtfoolip # Friday, January 1, 2010 3:02:00 PM
Serav # Friday, January 1, 2010 5:45:14 PM
Supporting both would allow compatibility with a greater majority of video now using the
Daniel HendrycksDanielHendrycks # Friday, January 1, 2010 6:22:55 PM
Originally posted by Philip Jägenstedt:
Malan from Disney?
Daniel HendrycksDanielHendrycks # Friday, January 1, 2010 6:24:40 PM
Originally posted by Philip Jägenstedt:
When Vega adds HW acceleration will the FPS increase?
Philip Jägenstedtfoolip # Friday, January 1, 2010 7:23:02 PM
Originally posted by Serav:
I can't comment on the legal situation or other projects, but Opera can't distribute MPEG-4 decoders at this time.
Philip Jägenstedtfoolip # Friday, January 1, 2010 7:25:55 PM
Originally posted by DanielHendrycks:
No, but there's a Chinese connection.
Originally posted by DanielHendrycks:
It doesn't look like it's a performance problem right now, it's rather a timing problem. Hardware acceleration may help reduce CPU usage though.
theoddbod # Friday, January 1, 2010 8:10:08 PM
Serav # Saturday, January 2, 2010 12:14:34 AM
Originally posted by foolip:
Fair enough. I was just curious so thanks for the answer.
Cutting Spoonhellspork # Saturday, January 2, 2010 1:50:54 AM
Tacking controls on to the face of VLC's existing browser plugin wrapper, would in fact be rather nice. I already open videos in Opera windows, VLC is cross-platform last time I checked. I suppose there are always legal hurdles, though.
Barraco Mármol Jerónimojerobarraco # Saturday, January 2, 2010 2:19:06 AM
Witold Barylukmovax # Saturday, January 2, 2010 10:44:53 AM
Originally posted by lucideer:
Someone should learn them how to properly use video tag. Why the hell they are doing any hardcoded browser detection!? Just embeded video element directly, browsers will decide for they own if they are supporting it or not, and if not provide fallback content inside of the video tag body. Eh.
http://camendesign.com/code/video_for_everybody Example how it should be done.
NEOAethyr # Saturday, January 2, 2010 3:09:33 PM
Are you using ffmpeg/ffdshow for the theora video decoding?
http://sourceforge.net/projects/ffdshow-tryout/
If so then you should have no prob any video/audio pretty much.
I assume it depends on what this GStreamer thing allows in ogm files.
Halli supposedly shares his splitter code with those who ask:
http://haali.su/mkv/
That does ogm, avi, mkv and mp4.
Then with flash video's, you could rip the code from media player classic (probably from mpc-hc) for the stand alone flv splitter.
I've only seen that outputted to ax format, I dn if linux can deal with that or not.
If you could get flv files working.
A script that gets the direct link off youtube and puts it in a video tag.
You could disable the flash pugin and still play it back
That would rock.
Anyways whatever you decide to do.
Good luck to ya.
It's better then flash anyways.
Philip Jägenstedtfoolip # Saturday, January 2, 2010 5:32:44 PM
Originally posted by NEOAethyr:
No, we use GStreamer, which is a media framework just like DirectShow. We don't mix the two currently, because there doesn't seem to be any benefit in doing so.
Pharaoh Atem (ニール・ゴンパ)Pharaoh_Atem # Monday, January 4, 2010 7:11:55 AM
It is rather trivial to add in detection logic to the installer to find GStreamer and configure Opera to use it, at least, if it is was a script based installer. And of course, if no GStreamer installation is detected, then Opera's own minimal one is installed and used instead.
Tim Lawrencepanzeroceania # Monday, January 4, 2010 8:26:45 AM
Philip Jägenstedtfoolip # Monday, January 4, 2010 9:18:51 AM
Originally posted by panzeroceania:
OSS is a sound system while GStreamer is a media framework (like DirectSound and DirectShow). GStreamer may already be using OSS for audio output, depending on your system setup.
Pharaoh Atem (ニール・ゴンパ)Pharaoh_Atem # Monday, January 4, 2010 11:16:45 AM
Daniel HendrycksDanielHendrycks # Monday, January 4, 2010 4:28:16 PM
Philip Jägenstedtfoolip # Monday, January 4, 2010 7:18:34 PM
Philip Jägenstedtfoolip # Monday, January 4, 2010 7:23:10 PM
Originally posted by DanielHendrycks:
FLAC (and lots of other codecs) are properly detected and used on Unix (flacdec is in gst-plugins-good) if you want to play with it. As FLAC isn't terribly useful on the web due to its size, we probably won't support it on other platforms (keep in mind that every added codec adds to the download size of Opera).
The lossless Ogg video you talk about actually already exists -- Dirac has a lossless mode. However, lossless video seems even less useful than lossless audio on the wider web
Daniel HendrycksDanielHendrycks # Monday, January 4, 2010 7:46:26 PM
Daniel HendrycksDanielHendrycks # Tuesday, January 5, 2010 12:01:44 AM
Charles SchlossChas4 # Tuesday, January 5, 2010 5:49:49 AM
New Video File Format Promises to Work on Any Device [CES 2010]
http://mashable.com/2010/01/04/dece-ces-2010/
Ruarí Ødegaardruario # Tuesday, January 5, 2010 7:33:08 AM
Originally posted by DanielHendrycks:
Actually, from my perspective the real purpose and advantage of baseline codecs is that a web master can take for granted that they will be present and supported by the browser. Even with the slightly fuzzy situation right now of two competing codecs (Ogg Theora and H.264), it is still better than nothing in that it is either one format or the other (personally I think it is still quite possible that a final solution might be reached before the new video tag really takes off).Furthermore, it is not really a problem to be reliant on certain core patent free GStreamer plug-ins (those that provide Vorbis audio codec and the Theora video codec) as these are ubiquitous on Linux, across distros and processor architectures, given their Open Source status and lack of licensing restrictions. Hence they can be made a dependency of the Opera .rpm and .deb packages if needs be, ensuring they are installed by the native distro package manager at the time of install of Opera. This was not a reasonable option for regular plug-ins like Flash for numerous reasons, the two most obvious being licensing issues and support for a limited range of processor architectures.
From the perspective of most end users users, having the package manager deal with installation of the required media plug-ins is the same as bundling the plug-ins. Better in fact in that duplication of libraries is avoided and an advanced user with no interest in video could override the dependency should they prefer not have the files on their system (.e.g. to keep the size down on a micro distro).
As foolip mentioned if other plug-ins are available and the page suggests it, then great, we'll use them .. but .. the browser only expects the standard baseline plug-ins to be available by default. Everything else is just a nice bonus!
Tim Lawrencepanzeroceania # Tuesday, January 5, 2010 7:42:46 AM
Originally posted by foolip:
could it be an optional addition? just as widgets and Opera Unite apps are optional, surely you could have other optional codecs that aren't part of the standard opera install.
Ruarí Ødegaardruario # Tuesday, January 5, 2010 7:51:24 AM
Originally posted by panzeroceania:
This already works (on Linux/UNIX at least) but the only codecs that the web master can take for granted as being present are the the Vorbis audio codec and the Theora video codec.
Witold Barylukmovax # Tuesday, January 5, 2010 5:10:32 PM
Originally posted by foolip:
O hear only one movie, second is running but is silent.
It can be problem with output. My system runns ALSA but also have OSS emulation, so it is possible that it selected OSS. But when i was testing Opera and Totem (or mplayer) in parallel i heared both simultaniously. So it doesn't look it a OSS problem.
I will check which audio output method gstreamer in opera used.
It is definietly not OSS (because i inspected `lsof` and no /dev/dsp is opened), and it is probably PA (because it is so in `gstreamer-properties`), and PA is using ALSA. SO mixing should work.
I'm running Debian.
PS. I just tested it again, in Two detached tabs, and video and audio is working properly (mixing works). Strange.
Witold Barylukmovax # Tuesday, January 5, 2010 5:34:17 PM
Originally posted by foolip:
It happens for example on "Video and Canvas performance demo" link.
(it doesn't happen on Wikipedia, it doesn't happen on TinyVid or Video for Everybody, or MetaVid).
It is exactly 100 messages "mmap() failed: Cannot allocate memory" (of course there is plenty of RAM free, but as I have 32bit system, it is probably trying something which will not fit in address space). It happens only on starting of movie (and it plays fine). I'm running Debian unstable :/ But no other player (probably) shows me something similar. It isn't also very easly reproductible. SOmetimes i have this error, sometimes not.
PS. Tested on another computer (with Debian testing i386). No such issue (no mmap messages), or i just can't trigger it.
Witold Barylukmovax # Tuesday, January 5, 2010 6:21:57 PM
GO to http://people.freedesktop.org/~company/stuff/video-demo.html and set zoom to 30%. Webpage will not zoom out completly, but it will be 30% height and 100% width, with not proportionally scalled movies. bottom 70% of webpage will be just blank.
100% http://img30.imageshack.us/img30/228/zrzutekranu1u.png
20% http://img177.imageshack.us/img177/2149/zrzutekranu2k.png
Others webpages with video doesn't have problem with zoom/scalling.
Cutting Spoonhellspork # Tuesday, January 5, 2010 6:34:46 PM