徐继哲

徐继哲的分享

他的个人主页  他的分享

Working with Ogg Theora

徐继哲   2009年08月29日 星期六 10:52 | 0条评论

The Free Software Foundation's Holmes Wilson is just back from Berlin, where he participated in the Ogg Theora book sprint put on by FLOSS Manuals . Here is a broad look at Ogg Theora and how it fits into the push for free formats: where we're winning, what works, and what could be improved.

Translations : العربية(Arabic)

UPDATE: In response to comments on this post I've added an update and FAQ (see below).

Introduction:

Ogg Theora is becoming a big deal, and that's exactly what we hoped for when we launched the PlayOgg campaign in May 2007. The free, patent-unencumbered video codec now works in over 24% of the world's web browsers with no plugins required. The latest 1.1 release of the Theora encoder is coming out any day now. And when it does, the huge improvements in quality and functionality made over the past year with support from Wikimedia and others will percolate out into the major GNU/Linux distributions, arriving at the fingertips of those who build and maintain the world's biggest video sites. Most of all, people are excited, releasing new tools that make the Theora easier to use, as well as jaw-dropping demos of what free formats and web standards can do.

I'm freshly arrived from Berlin, where FLOSSManuals just hosted a book sprint on everything Theora, from politics to playback, encoding, hosting and even streaming--all using free software and web standards. The main goal of the trip was to get an idea of where Theora is at: what's working well, what's still difficult, and the best ways to push adoption forward (both by organizing people and by making easier-to-use tools). Overall, I think we're close to something that can work for large numbers of people watching and publishing video, though there are still some tricky bits and sacrifices that--in an ideal world--you wouldn't have to make. Wherever possible I've linked to the relevant bits in our new Theora manual for anyone who wants to learn more.

Playing Theora videos

For anyone who wants to play a Theora video on their desktop, there's always a simple answer: get VLC (the same answer to the question of how to play almost any format). Since the 1.0 release, VLC has almost 25 million downloads, so lots of people already have it. For GNU/Linux users, Theora playback should be included with almost every distribution. And of course, you can also just open the file with Icecat 3.5 or later, or any equivalent Gecko-based browser.

Video quality

Don't believe the FUD : the quality of Theora-encoded video for a given bitrate is excellent. While there are some reasons to consider h.264 to be technically superior, the difference for web-quality video just isn't noticeable. See for yourself, here and here .

Theora isn't ideal yet for HD video (something about the motion vector being too small) but the consensus was that this is very fixable. Also, for web video publishing, you can use a tool like Firefogg to go straight from your original video (in any format) to the smaller web version-- instead of transcoding once before upload and again on the site (like you would while publishing to sites like Dailymotion, Youtube, Vimeo or Blip.tv)

Video hosts

Most video publishers just want a place to put their video where they don't have to worry about formats, bandwidth, and hosting. And while Youtube doesn't support Ogg Theora yet, there are several smaller sites that do. See the Hosting Sites section in the Theora manual for an overview, or here's a quick list:

So if you're looking for a quick way to post videos for distribution in Theora, there are some great options to choose from. Unfortunately, with the exception of Dailymotion, most of these sites do not have the large built-in audience or the advanced rating / sharing features of a site like Youtube. As advocates for free formats, we need to figure out how to push more large video sharing communities like Youtube to take the plunge ( as Dailymotion already has ) and offer videos in Theora.

Putting videos on your own site.

Now that HTML5 and Theora support in browsers has made video a "first class citizen of the web", it's easier than ever to post a video to your own site without relying on a middleman like Youtube. The Theora Cookbook includes an excellent overview of how to post videos using HTML5 and Theora. You can upload and display videos on your site just like images or HTML pages, but there are a few tricky parts:

Tricky part #1: Mimetypes.

Since the video tag is a new thing, your web host might not set the mime types correctly. One of the Theora developers at the event told me that, when somebody comes on the Theora IRC channel and says "Hey, I just posted a video and it doesn't work!" it's almost always a problem with mime types and headers. If your host isn't setting the mime types right, you either need to edit your .htaccess file or (if that's off limits) offer the videos using a PHP script. The Hosting Theora Yourself chapter describes both of these solutions in detail.

Tricky part #2: Allowing remote access or direct linking

Remember how sites used to (or sometimes still) get irritated when people link directly to their images? For better or worse, the HTML5 video spec defines a way to prevent this. So if you want people to be able to link directly to videos on your site, you need to enable it. See here for how to do this for all sites, or for specific sites.

Tricky part #3: Fallbacks for non-compatible browsers

Even before several browsers supported Theora natively, the free software community had a reliable (if slightly non-ideal) way to play Theora videos in the browser: the Cortado java applet. Now, Cortado is handy as a way to let all those weird IE and Safari users (at least the vast majority of them who have Java installed) watch the Theora videos you post to your site. The HTML5 Video chapter in the manual explains how to automatically fallback to Cortado for non-compatible browsers, and it includes sample code. The one major drawback of Cortado, which seems unavoidable, is the long loading time--your viewers will spend a good several seconds watching the Java teacup logo wondering why the video isn't playing. When using a Cortado fallback, it's probably best to include a link recommending a Theora-capable browser.

Making it easy for others to upload Theora.

If you're running a video host or some kind of community video site, you will need a way for people to upload Theora without necessarily knowing what Theora is. The standard way to do this is to allow uploads in any format and then transcode them all (like Youtube et al). The ffmpeg2theora tool will convert practically any video under the sun to a Theora video with the quality, bitrate, and other characteristics desired. Check out the ffmpeg2theora chapter in the manual for more on how to use it.

Firefogg --a browser extension for transcoding and uploading Theora videos--is another way to address the transcoding problem, and it has some unique advantages. Once users have installed Firefogg in their browser, sites can call it in their upload form. When users select a file, Firefogg will convert it to Theora as part of the upload process. With some extra configuration on the server side, Firefogg can even upload pieces of the file as it's doing the conversion to save time. Firefogg will also ensure that, if the connection goes down, the upload will resume as soon as the connection comes back.

Firefogg brings two important advantages. First, sites (or web applications like Wordpress) could rely on Firefogg instead of having to develop a transcoding system on the server side. Second, the video quality can be better, because the video only gets converted once (instead of twice-- once before upload, and once on the hosting site). The main disadvantage of Firefogg is that users need to install a browser extension. But perhaps someday Icecat itself could include this feature.

Conclusions

The push for free video formats is at an important moment: the necessary parts of an online video space based on free formats are in place, and it's all a matter of how we use them (and who uses them). Theora playback now has a mass user base: tons of people use VLC, and orders of magnitude more people use Gecko-based browsers. Anyone who wants to distribute their video on the web in a free format can upload it to Dailymotion, Tinyvid, or the Video Bay with minimal hassle. With Cortado, we have a fallback for people with older or non-compatible browsers that doesn't require non-free software or non-free formats. HTML5 and the video tag give developers new ways to manipulate video on the fly , setting the stage for entirely new kinds of interaction around video.

To me, the missing pieces seem to be in video publishing and general awareness. Specifically, we need:

More Theora support from video hosting sites So far, only one large video host supports Theora. The free software community needs to find effective ways to push Youtube, Facebook, Blip, Vimeo (as well as the large video advertising services) to run pilot projects and move towards full HTML5/Theora support.

A Theora upload plugin for popular free software publishing platforms If you could upload any video to web publishing systems like Wordpress using Firefogg, and automatically present it with a Cortado fallback, this would dramatically reduce the number of steps required to post a Theora video on your own site.

Effective evangelism We need organized ways that people can convince the sites they like to publish in free formats. We also need ways for sites that use free formats to declare their support for the cause, and make the social mission behind their decision visible to users.

The FSF will be working on all these angles and more as part of its PlayOgg campaign. If you'd like to help out, get on playogg-discuss . Or if you have any specific comments on this article, email me at holmes at fsf dot org. Finally, anyone looking to become an expert on Theora should check out FLOSS Manuals' Theora Cookbook . The event was a great experience and the end result is solid. If you like it, buy a copy!

Update and FAQ

This article spurred some excellent discussion on Digg, so I thought I'd include the highlights, and some of my responses in a mini-FAQ:

What about hardware acceleration for improved battery life on mobile devices?

Theora doesn't have that yet, but if it becomes a popular way to post videos to the web, it could happen soon. In the meantime I'm okay with putting a bigger battery in my phone to be able to watch videos in formats other than h.264.

Most of the cheap "MP4" players (aka the iPod of the developing world) now support the free audio format Ogg Vorbis. They don't even advertise it, but the one manufacturer that makes all the chips simply included Ogg Vorbis support. Hardware support will probably happen, it just takes a little while.

What about Dirac?

There are other important projects with similar goals, like Dirac, an effort spearheaded by the BBC. But the exciting thing about Theora is that it's here now, supported by popular tools, and ready for mass adoption.

We expect Ogg Theora to have its strength in online video distribution, whereas Dirac will most likely have its strength in high definition footage.

Didn't Google just buy a more advanced codec that it's going to offer as a free format?

That would be awesome, but it's not a good idea to base a free formats strategy on what Google might do.

Advocates for free formats aren't trying to priviledge Theora over other free video formats. We're just trying to get a foothold with something that we have now, and that works now. If some better patent unencumbered format comes along, we'll rush to include that under the umbrella.

评论

我的评论:

发表评论

请 登录 后发表评论。还没有在Zeuux哲思注册吗?现在 注册 !

暂时没有评论

Zeuux © 2024

京ICP备05028076号