The problems with <video> and <audio>, and conundrum Firefox faces

By on

Firefox on Android - and it'll soon come with H.264 support (Image: Mozilla EU/Flickr (Creative Commons))

In recent days, the tech community has been buzzing around about the fact that Mozilla has decided to relent on its open web stance and will implement H.264 on mobile devices and – although unconfirmed – speculation hints that it will soon be included in the desktop version. But why is this such a big deal? It’s just some stupid technical thing.

Oh, how wrong you are. But, let us get some background information of the issue.

What is <video> and <audio>?

Put simply, they are just normal HTML elements like <div>, <strong>, <object> and <iframe> (the latter two more commonly known as adding YouTube videos onto, let’s say, a blog post). However, they would allow a video or an audio file to play without the need of some Flash or plug-in. You would be able to control the video or audio via the browser’s default player, or – if you were competent – make your own player using HTML, CSS and JavaScript.

Essentially, they make it easier to place audio or video onto a page without downloading some Flash player from the web, or making one from scratch.

They were introduced as part of an overall refresh of the HTML specification. Known as HTML5, it will be the fifth time that the World Wide Web Consortium (W3C) has updated the language. It should be pointed out that HTML5 is still a draft with many people adding their voices to what should be added and removed. And to this day, features are constantly changing

But, if it is a draft, why is this now being implemented?

Rather than use Flash, Apple has adopted HTML5, CSS and JavaScript – all open standards… and controlled by a standards committee, of which Apple is a member.Steve Jobs in a letter

Well, you have to thank Steve Jobs.

Because the fact the iPhone did not support Flash, the most popular (and much hyped) smartphone couldn’t play video from many sources except via YouTube. In response to much criticism, Jobs offered the alternative – HTML5. And just like that, the <audio> and <video> tags were quickly used to let users play such content.

“Rather than use Flash, Apple has adopted HTML5, CSS and JavaScript – all open standards. Apple’s mobile devices all ship with high performance, low power implementations of these open standards. HTML5, the new web standard that has been adopted by Apple, Google and many others, lets web developers create advanced graphics, typography, animations and transitions without relying on third party browser plug-ins (like Flash),” Jobs wrote in an open letter in 2010.

“HTML5 is completely open and controlled by a standards committee, of which Apple is a member.”

The file format question

Well originally, the HTML5 specifications called on the use of the open-source Ogg file formats (Theora for video and Vorbis for audio). They were chosen because they were royalty-free, open and not affected by the complex mishmash of patent law. However, Apple had an issue with it, claiming that there could be unknown patents that might affect its implementation.

This actually has happened before – with the GIF file format. Widely used because CompuServe released it as a free and open format, the technique to compress the images was actually patented – but no one, even those from CompuServe, was aware of it. The company who held it, Unisys, decided to get royalties from it. And they were successful, with a deal signed that saw developers being charged a fee to use GIF.

Yes, you were going to be charged a royalty to use a stupid GIF image. The patents have now since expired; though, without this fiasco, we wouldn’t have the much more open PNG image standard.

Back to the file format question, after constant bickering between the major browsers, the W3C basically gave up.

“After an inordinate amount of discussions, both in public and privately, on the situation regarding codecs for <video> and <audio> in HTML5, I have reluctantly come to the conclusion that there is no suitable codec that all vendors are willing to implement and ship,” Ian Hickson, the author of the HTML5 specification, wrote in a newsgroup.

“I have therefore removed the two subsections in the HTML5 spec in which codecs would have been required, and have instead left the matter undefined, as has in the past been done with other features like <img> and image formats, <embed> and plugin APIs, or Web fonts and font formats.”

In other words, you can embed whatever video and audio file you want – like you can embed a JPG or even a TIFF image (the latter depending on the browser) to a web page.

Problem? What problem?

The browsers have split in terms of their support. In terms of <video>: Google, Mozilla and Opera are backing WebM; while Internet Explorer and Safari are backing H.264. It should also be noted that Google owns WebM and after acquiring the company who held the patents decided to make it royalty-free. They have also publicly stated that they will drop H.264.

That, however, was made in January 2011 – and now we’re in March 2012. It appears that Google will never dump it.

H.264 will most likely be the victor in this format war – and Firefox has already conceded that point. Not because of quality – both are arguably the same – but because of market support. H.264 is used everywhere. If you watch a video on services such as Vimeo or YouTube, the video is encoded into H.264. If you record footage using a camera – even on a camera phone – then the footage is in encoded into H.264.

But why are Mozilla and Opera refusing to support H.264? Well, it is mainly the patents. Basically, they cannot afford to pay for such licenses since they don’t have the same amount of money as Microsoft, Apple and Google.

Then we have the <audio> file formats problem – not all browsers support the same file format. IE, Chrome and Safari all support MP3 and AAC. And again, we have the same issues presented in <video>. Since AAC and MP3 are patented, Mozilla and Opera have opted to use the royalty-free alternative – Ogg Theora.

MP3, in particular, has a really complicated patent licensing arrangement – mainly because there are so many bodies who claim ownership. One case in particular – the Alcatel-Lucent vs Microsoft case – highlighted the mess with Microsoft saying it already has paid royalties to Fraunhofer IIS to use the MP3 patents. It eventually lost the battle, after Microsoft appealed a decision to award US$1.52 billion to Acatel-Lucent.

Firefox relents?

Image: Adriano Gasparri/Flickr (Creative Commons)

H.264 is absolutely required right now to compete on mobileBrendan Eich, Mozilla CTO

Mozilla has always advocated for a more standardised, and more open web. But by supporting H.264 goes against all of its principles. It hasn’t made the move lightly, but in a pragmatic sense, it is understandable.

Apple has basically transformed H.264 as the semi-official standard for video on the web in the mobile realm. Even Android has been forced to support H.264 in 3.0 Honeycomb (it implemented WebM in Gingerbread). And for Firefox, it is embarrassing for a browser to not support the most dominant standard out there – with new figures highlight that 80% of all video coming through HTML5 are encoded using H.264.

Image by: MeFeedia

“What I do know for certain is this: H.264 is absolutely required right now to compete on mobile. I do not believe that we can reject H.264 content in Firefox on Android or in B2G and survive the shift to mobile,” Mozilla’s CTO Brendan Eich wrote in a blog post.

And Eich is right. With people moving to mobile to consume more and more online content, it is impossible for a browser to not support a format that has become a de-facto web standard. Of course, Firefox has made this clear that for now it is absolutely necessary for mobile devices – especially since of one thing.

Adobe is no longer developing Flash for mobile devices.

Flash has always been Mozilla’s get-out clause to stream AAC, MP3 and H.264 video without downloading the file. Even HTML5-built websites cannot ignore Flash, because of cross-browser support. For example, JB Hi Fi Now supports HTML5 audio playback – but not for me on a Firefox browser, because it streams MP3 files via the <audio> element. Instead, a Flash Player is doing what Firefox can’t.

Flash, as much as it pains people in the open web to hear, is Firefox’s saviour in this huge debacle of file formats.

Another question that should be asked is that, if H.264 is supported (even if its just mobile) is there some expectation that Mozilla also support MP3 and AAC? They, like H.264, are heavily supported in the market unlike Ogg Theora. As mentioned before, they are patented – and MP3 itself is entrenched with licensing issues.

Should Mozilla suck it up and implement it, despite its commitment for an open web?

That’s a question that its developers, contributors and supporters will have to ask themselves. They can either choose to stick to their principles, or make the web more usable for web developers and users by having formats that have both market support and a majority of its rivals (sans Opera) support.

WebM has been a nice distraction, but it is time for Mozilla to choose.