MPEG-2 support for your Pi

When you’re trying to put a computer together for US$25 you clearly have to cut a few corners. However the Raspberry Pi has managed to do more computing with $25 than any computer in history. Still that didn’t stop plenty of people complaining about one apparently crucial missing feature: the lack of MPEG-2 video playback support.

We reckon the fact that this tiny computer manages to play back 1080p H.264 video remarkably well let alone at all is a complete bonus. Still the technology actually exists in the Broadcom BCM2835 processor. The way these chips work is that you can pay for whichever audio and video codecs you want and set the appropriate register bit to indicate which codecs are ‘switched on’. To keep costs down the Pi Foundation chose to pay only for AAC audio and H.264 video playback.

However given the goal of the Pi was actually education rather than home theatre it’s come up with a novel solution: instead of jacking up the price of the board for everyone to include MPEG-2 and VC-1 (Microsoft WMV9) playback you can pay the licence fees for your particular board at the Raspberry Pi web site at www.raspberrypi.com. The cost is in keeping with the Pi itself – you’re looking at around $3.50 for MPEG-2 licensing and around $1.80 for VC-1.

How it works

The individual licence you buy will be tied to your particular board which is done through the chip’s internal 16-digit serial number. You can grab it by firing up your Pi with any distro launching Terminal and typing: cat /proc/cpuinfo . You’ll see the serial line entry in the text. Grab that and load it into the entry box on the buy page.

Although the Raspberry Pi Foundation isn’t giving away too much about how it works you’ll be emailed a key within 72 hours along with information on what to do with it. It’s in the public domain (you can read this information from the Raspberry Pi forum at tinyurl.com/cx9kr5s and tinyurl.com/czqr7pz) that the key is used as a single line of text along the lines of: decode_MPEG2=0x12345678 . You add this into a ‘config.txt’ file (the same one you’re using if overclocking).

If you have multiple Raspberry Pi boards you have to buy a key for each board but you can make it easier on yourself by loading all of your keys into the one line; for example: decode_MPEG2=0x123456780x87654321 .

Then copy that ‘config.txt’ file onto all of your SD card boot disks. Because the key is tied to your board’s serial number you can’t hack it and just throw anything in there – think of it like Windows activation. Still if it supports the Raspberry Pi Foundation why not pay the $3 and be done with it?

Once you’ve set it up you need to reboot your Pi and it should then be capable of playing MPEG-2 video files and DVD movies on a USB DVD drive with the appropriate software.

CEC support & H.264 encoding

We’ve mentioned raspbmc before as an ideal way to turn your Raspberry Pi into a simple-boot home entertainment system powered by the goodness of XMBC. It turns out that this specific-function distro now supports libCEC.

CEC (consumer electronics control) is a subsection of the HDMI standard that allows one remote to control more than one device through the HDMI chain. For example you’re watching a Blu-ray movie you turn off your TV via the remote which also automatically turns off the Blu-ray player – that’s CEC at work. You can now do something similar through the libCEC library now built into raspbmc.

And finally H.264 encoding has been enabled in the rpi_update firmware. It turns out that the Raspberry Pi people didn’t realise they got the encoder included in the H.264 licence fee.