LinuxDevCenter.com
oreilly.comSafari Books Online.Conferences.

advertisement


Freevo: Freedom For Your TV

by Howard Wen
01/27/2005

"Freevo, for me, stands for freedom and the power to do whatever I'd like with a TV interface," says Rob Shortt, a 29-year-old system administrator from Dartmouth, Nova Scotia, Canada. Shortt is one of the main developers of Freevo.

Freevo is a media platform that brings together various applications for video recording and playback. Under its open format, the user can fully customize Freevo to suit his media viewing needs. Its main feature is its ability to schedule and record television broadcasts (Figure 1).

the Freevo TV program guide
Figure 1. The TV program guide of Freevo, shown with the Blurr interface skin

Krister Lagerstrom originally conceived of the project. The first release, in May 2002, consisted only of a blue screen and simple menu bar. Since then, Freevo has evolved beyond just recording TV broadcasts--it can play and manage other media like music, pictures, and even games. "It's relatively complete, and has far surpassed our original plans," says Aubin Paul, whose principal contribution to Freevo has been designing its user interface. The 26-year-old is a university student from Toronto, Ontario, Canada studying economics.

What is the difference between how Freevo works versus TiVo, similar devices, or software products like Windows XP Media Edition? Though its name sounds like a knock on TiVo, the Freevo developers emphasize that their project is more than software that turns a Linux computer into a digital video recorder (DVR). They refer to Freevo as a "platform" as opposed to a mere application. "It's important to note that almost everything in the system is a plugin, so you can essentially build your media center the same way you build a physical system," says Paul. "You can choose the applications, functionality, and interfaces you like."

Because Freevo is on an open platform, users can create plugins that do things TiVo and other PVRs cannot: for example, transcoding video, burning media files to CD or DVD, ripping and copying CDs and DVDs, viewing streams from the Internet, and file sharing. "I even have a plugin to check my voicemail," says Shortt. "Our open platform is our strength. It is also very easy to develop Freevo plugins."

For example, Freevo can serve as a media jukebox for music files and, as shown in Figure 2, movies. It can also display digital photos and other image files on a television set (Figure 3).

Freevo's movie guide
Figure 2. Freevo's movie guide, shown with the Noia skin

the Freevo photo album
Figure 3. The Freevo photo album, shown with the Noia skin

Applications Controlled by Python

Related Reading

Learning Python
By Mark Lutz, David Ascher

Thanks to its versatile plugin interface and menu system, Freevo can run as the operating system for a multimedia set-top box. The software does require fairly powerful PC hardware to maximize its full usefulness, but it manages to run acceptably on a lower-end system--like that with a Celeron 400MHz processor.

Freevo's interface was originally a C daemon that wrote directly to the frame buffer, but Paul soon replaced it with SDL (the Simple DirectMedia Layer) via the Pygame library. Lagerstrom made the choice to go Python, a language with which Paul was completely unfamiliar at the time. Since then, Paul says, "The language is one of the best collaborative languages I have ever used. I wonder if we could have reached the point we have without the short learning curve and power of Python and its related libraries."

Because Freevo itself is not a video or music player application and is, instead, designed to control other apps, its code has to make heavy use of plugins to interface with other programs. "Python is a good language to control other apps, and this is one of the reasons it was chosen," says Shortt.

In fact, Freevo is essentially a patchwork of several applications and media libraries--derived from a diverse range of other free software projects--brought together. At the core of Freevo is the aforementioned SDL/Pygame library, which provides platform and UI independence, and MPlayer, which affords most video and audio functions. Other major projects included within Freevo are xine, the Python Imaging Library, and the Python Twisted Framework.

"Twisted [is] an awesome network application framework for our web server and record server," says Shortt, though development for the next release has gone in a different direction. "In fact, we are now even more lightweight, as we've stopped using Twisted and replaced the features we used it for with some other libraries." For example, the current development code uses pyNotifier for the main loop and pyMbus for communication, both projects developed at the University of Bremen TZI by colleagues of another Freevo developer.

Various small Python modules were borrowed from other projects, including Freevo's XMLTV parser, a module that interfaces with the Amazon web site, and another that pulls weather data.

"In most cases, the projects were chosen because they could integrate smoothly. Also, for us to write a media player, web server, image processing tools, and the other diverse requirements of this type of platform would have been a huge task. I imagine we'd still be writing a media player right now, were it not for MPlayer and xine," says Paul.

In turn, Freevo has spun off several smaller projects and the Freevo developers have contributed code to many others. The main spinoff project is the mmpython library, which acts as a metadata parser for a large and growing number of file formats. The bmovl filter for MPlayer was written by a Freevo developer and originally meant for Freevo use; another Freevo hacker picked up on this work to create bmovl2.

User Interface Design Challenges

Because Python can be slow when executing some tasks, a great programming challenge throughout Freevo's development has been optimizing the code to run as fast as possible. "Sometimes Python is too slow for the needed task. Most of the time we can avoid such problems by rethinking the design," says Dirk Meyer, the Freevo project's 28-year-old lead developer from Bremen, Germany.

Polishing the user interface initially also proved to be vexing. Because he had some experience in UI programming in Java, Shortt built a small, object-oriented UI toolkit for Freevo, which included containers and a simple layout manager. "That was kind of fun for a while, but it never performed great," Shortt concedes. "Other Freevo developers had done an excellent job on our skinning engine, so I opted to find more ways to use that, and Dischi has since rewritten the GUI 'objects' to use a new graphics interface, Mevas."

However, the project is changing its use of DirectFB. It is always a challenge to abstract graphics handling to support different display engines. Migrating the code to the Mevas canvas library as the layer between Freevo and multiple back ends (including SDL, DirectFB, and imlib2) has made life easier. "Using Mevas, I have been able to use Python bindings to the DirectFB library," says Shortt. "This way, Freevo itself could be a DirectFB application, and we'd have full control of its surfaces, layers, windows for things like a consistent on-screen display, video windows for preview, or picture-in-picture--goodies like that."

Microsoft To Control Freevo?

Because Freevo itself is not a video player, it has been difficult for its developers to implement time-shifting of live TV (which allows the couch potato to pause and rewind through a television program as it is being broadcast). Adding this has been elusive, but recently a few enthusiasts of Freevo have achieved some success in this area by hacking MPlayer to perform time-shifting live TV under Freevo.

One of Paul's pet projects for a future version of Freevo is to include query-based playlists, a feature directly inspired by those of Gmail and iTunes--basically, rather than an audio playlist being a fixed set of files, it is a query; perhaps "all songs from 1993" or "my highest rated." The rating system and database needed for such a feature exist currently within the Freevo code, and all that has to be done is to actually build it.

"I'd also like to add support for the Microsoft Media Center Remote, which seems very nicely designed for this type of application," says Paul.

It might sound ironic to enable a remote control designed for use on a competing product, especially one from Microsoft. But for the Freevo team, it fits in exactly with their design goals.

"Freevo is only a GUI for other applications," says Meyer. "So we use external applications. Why re-invent the wheel?"

Developer Interview: Freevo

The Freevo development team recently discussed their Linux media center application with the O'Reilly Network.

Howard Wen: How does Freevo differ from MythTV?

Dirk Meyer: MythTV uses QT, which uses X. Freevo should also run on a frame buffer, a DXR3 or something else. The next difference is MythTV depends on a MySQL database. Freevo always was a GUI for external programs. There was never the idea to build a TV application like MythTV inside Freevo.

Rob Shortt: MythTV has the live TV time-shifting nailed, and for that I am envious. While Myth has the advantage in [this], I think Freevo does a better job of other media handling.

Freevo tends to be a more nimble program, or I should say "platform." This has to do with us not using a data server like MySQL or depending on Apache for the web interface. Instead, we use a combination of caches, object serialization, XML files, and SQLite for persistent storage, and our own lightweight web server using Twisted.

Aubin Paul: MythTV is exceptional, and I admire much of what they've done. But I don't like some of their design choices. For example, why would I run X-Windows on my TV?

HW: What motivates each of you personally to keep working on Freevo?

AP: Freevo "runs" my living room, so its features are a constant convenience.

The other programmers on the team are extremely bright people, and in spite of the reputation of open source projects being a collection of bigger and bigger egos, there is a sense of humility and shared goals.

RS: Developing Freevo has been loads of fun and seeing the results is thrilling. My fellow geeks can probably relate to that fuzzy feeling you get when you accomplish or experience something very cool, like a nice new feature or convergence of technology.

DM: I plan to build a small Freevo box to have a DVD player, VCR, MP3 player, etc. in one box.

HW: What would you like others to pay notice to the most about Freevo?

AP: I hope people enjoy the interface.

RS: That it's not just a "PVR." I guess that's one problem with using a name that plays off the TiVo [name]. Freevo is really a platform for television and home-theater-based applications. We have a pretty good plugin interface, and it is easy to develop add-ons, even for the novice.

DM: New features can be done inside a plugin without any changes to the Freevo core and without much knowledge of the internal structure.

HW: If somebody wants to contribute to Freevo, what skills from them could you use now?

AP: Programming. Python is very easy to learn, even for people with only minor programming experience.

User interface design. While I'm a capable Photoshopper, it would be nice to have some additional themes, especially with different icons, since I'm just awful at those. I used a third-party icon set--with permission--in my Blurr theme.

RS: We could use help with documentation. I must say, though, that we have come quite a long way in the last year, thanks to Wiki and lots of people chipping in. I would consider our docs to be pretty good now, but most developers like to code, not write about it, so the docs tend to always lag behind the features a bit.

DM: I personally want better TV support in Freevo. There is no good TV player that can be used inside Freevo. I want live [broadcast] pause, commercial detection, VPS support, and other features MythTV and VDR have.

We really need more manpower to add new features to the Freevo core and build [and] patch external applications. If someone has some free time, we will gladly accept the help.

HW: What advice do you have for those wanting to modify the Freevo source?

DM: I guess most developers can learn Python very quickly, and it should be easy to understand how things work.

AP: The majority of people who want to add functionality can do so by writing plugins. So try and keep yourself encapsulated that way. If you want to modify the core, you can expect to have to do a bit more work.

HW: Why should anybody bother with building a digital video recorder, when you can buy a TiVo for much less money and hassle?

AP: When you purchase a TiVo or competing offering, you're at the mercy of the TiVo corporation, and the companies to which TiVo must concede, which include the MPAA and other trade groups that either want you watch lots of advertising, or don't want you to be able to record what you want.

People like to be able to tinker. It's an essential part of learning and understanding. It's like the difference between building your computer yourself or buying a Dell. The Dell is certainly easier, but it doesn't afford the same sense of accomplishment and customization.

The non-American/non-U.K. answer: A TiVo wouldn't work here [in Canada]. I'm part of the other 99 percent of the world for which a TiVo is not an option.

DM: There is no TiVo-like service in Germany. But even if there would be one, I still would choose Freevo or MythTV. Why? Because it's free--as in "freedom": you can change parts you don't like, expand parts to get more options. You can make Freevo look and feel like [what] you want.

RS: If someone wants a nice, shrink-wrapped product with a defined set of features, then one of the existing commercial offerings is probably better for them. Less hassle and less work for the user, but is it as satisfying? For some, maybe.

Freevo is about freedom and imagination. Because Freevo is completely open, anyone has the freedom to modify it, or add to it. We're not limited to specific features like some commercial products, and don't have some company telling us what we want or what's best for us. If I have a good idea, then I can add it!

So, someone who has a bit of know-how, ambition, and free time may choose Freevo, or another similar project, over TiVo. For these kind of people, it's not just the final product that matters--it's fun to build a machine, to hack around with code. It gives me great satisfaction to come up with something no one else has done yet and make it come to life on that TV screen.

Howard Wen is a freelance writer who has contributed frequently to O'Reilly Network and written for Salon.com, Playboy.com, and Wired, among others.


Return to the Linux DevCenter.


Linux Online Certification

Linux/Unix System Administration Certificate Series
Linux/Unix System Administration Certificate Series — This course series targets both beginning and intermediate Linux/Unix users who want to acquire advanced system administration skills, and to back those skills up with a Certificate from the University of Illinois Office of Continuing Education.

Enroll today!


Linux Resources
  • Linux Online
  • The Linux FAQ
  • linux.java.net
  • Linux Kernel Archives
  • Kernel Traffic
  • DistroWatch.com


  • Sponsored by: