Raspberry Pi Mpeg2 License Free

I've had a bit of a struggle getting this post written, because I have been fluctuating between: 'Wow, Look, that's really great!' and 'Why the heck doesn't that work?'

But I think that I have enough of it figured out now to make it useful to others — so here we go.

Raspberry Pi Mpeg2 License Generator

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community. MPEG-2, VC-1 and H.264 now available for Raspberry Pi users. The MPEG-2 decode license, is tied to your RPi’s unique serial number and will allow you to play MPEG-2 video from XMBC and omxplayer. H.264 encoding costs were separate from building costs, but they were not, thus H.264 encode and decode enabling is free of charge.

A bit of explanation is needed first. The creators of the Raspberry Pi initially decided not to include MPEG-2 and VC-1 codecs with every unit.

The decision was based on a combination of the cost involved — the licences required would have raised the unit price significantly — and their belief that the Pi would be primarily an educational tool, so there wouldn't be a lot of demand for these codecs. It didn't take long before it was clear that both of those assumptions were wrong; the Pi was wildly popular not only for educational purposes, and especially with the various Media Centre packages the demand for codecs was substantial.

My first question when I heard about these codecs was, 'what do I need or want these codecs for'?

Raspberry Pi : Vital statistics

As I have said many times, I am not a multimedia expert or even enthusiast, so the various formats and decoders often baffle me. Fortunately, there are a couple of good explanatory posts on the Raspberry Pi website — first, the announcement of the codecs, and then a what can you do with them, including a nice table that shows what plays and what doesn't with which decoder(s).

For my purposes, the important fact was that I needed an MPEG-2 codec to play commercial DVD movies. I know that there are various ways to rip/copy/convert such things so that they might play another way, but besides the fact that I will always choose the path of least resistance — especially when the cost involved is $2 — I simply don't do that kind of thing.

My next question was, 'how do I use these codecs'? Obviously they have to be installed somehow/somewhere, but where and how? Figuring that out, and getting it done, turned out to be a bit more trouble than actually buying them. Read on for details.

If you want/need these codecs, all you have to do is go to the Raspberry Pi Store and spend a very small amount of money. You will need the serial number of your Raspberry Pi, because the licence is keyed to it; the order page explains how to read that from the system.

The MPEG-2 codec costs £2.40, and the VC-1 codec costs £1.20, including VAT. In fact, the codecs only cost me £2 and $1 — I suppose because I am outside the UK or EU and they removed the VAT from my order.

I got an email confirming the order, and another confirming the payment (via PayPal) almost immediately, along with a statement that the licences would be emailed within 72 hours.

It actually took a lot less than that; my first order was for MPEG-2 only, made on a Thursday night, and I got the licence key on Friday; the second order, for VC-1, was made on Monday morning, and I got the key that afternoon.

To the very kind order-processing people at the Pi Store, I apologise for not ordering both licences at the same time, I was being a bonehead. To others who are thinking of ordering one or the other licence, I strongly suggest that you splurge and spend the extra pound or two to get both licences. The cost is minimal and the trouble it might save you and the people at the store is non-trivial.

What you get from the Pi store is an email containing the licence key, which you need to enter into the config file on your Raspberry Pi. There are three general ways to do this:

  • If you are running NOOBS, hold down the Shift key while the Pi boots. That will take you to the Install/Configure menu, with a list of available/installed operating systems. From there you can choose an operating system and then click 'Edit Configuration File'.
  • If you have another computer with an SD card slot, you can shut down the Pi, remove the SD card and put it into that system and edit the config file from there.
  • If you can get a Linux command line, either from the console or via ssh from another system, you can edit the config.txt file in place. The 'trick' here is that the boot filesystem is normally mounted read-only, so you have to remount it read-write, edit the file, and then put it back to read-only.

None of these methods is particularly difficult, so pick the one which you like best, or which seems least intimidating to you. Remember that you have to reboot after adding the key to the config file. Also remember that if you are running NOOBS, and have multiple systems installed which may use MPEG-2, you have to add the key to the config file for each of them separately.

I will also inject a plug here for the PiHub USB hub. If you are planning to connect an external USB DVD drive, you need to think carefully about it and check the power requirements for the drive. A lot of those things need quite a bit of power — from 0.5 to 1.5 amps — and if you simply plug it directly into the Raspberry Pi, it might be too much for the power supply you are using. The normal PiHub power supply is rated at about twice the output of a typical Pi power supply, so plugging a DVD drive into it should be no problem.

Finally, the most important question of all — how does it work? This is where things get a bit dicey. I did all of the following testing and playing with openELEC, but it was actually XBMC that was running so the results should be the same for RaspBMC or others which would then be using XBMC. The critical difference would be with different versions of XBMC itself, as I learned later, and have noted below.

I got a bit of a false lead when the first DVD I tried played just fine, and I thought the world was a wonderful place, until I realised that it was a DVD full of MP4 files. I already knew the Pi could play MP4, without any additional codecs. Grrr.

The next try was a commercial DVD, which also played OK. Yay! Getting to the DVD and getting it started playing was relatively slow, as I have become accustomed to on the Raspberry Pi, but once it started playing the performance was perfect — HD video, no problems with either video or audio jumping or stuttering. Good stuff.

Unfortunately, I then started running into problems. First, I found that if I changed the disc in the DVD drive, the title shown in XBMC would change, but I couldn't play the new disc, and in fact I couldn't even see any files on it. I had to reboot each time to get it to completely accept the new DVD.

Next, I found that some commercial DVDs would play and some wouldn't. The ones which did, such as the first one I tried, would play perfectly every time, and the ones which wouldn't play didn't work at all, ever — I couldn't even go in and select individual files to play.

I either got 'something didn't play', or I got useless, jumpy, blocky video and mostly no audio. So it wasn't any kind of intermittent or random problem.

Finally, I found that the DVD menus worked inconsistently or not at all even on the discs which played normally. Again, even on the ones which seemed to play OK, sometimes I couldn't select anything at all from the DVD menus, and pretty much all of the time the scene selection menu didn't work, for example. Not good.

I tried several different DVD drives, in hopes that it was something drive-specific, but no luck there. I even tried a Blu-ray drive, and got the same results when playing DVD discs (by the way, I had no luck at all playing Blu-ray discs, but I had expected that).

At this point I was going to try some different operating systems and media player software, but when I was looking around for possibilities I found some notes on the XBMC website describing exactly the problems I was having.

It seems that there are problems specifically with XBMC 12.3 (Frodo), which causes these kinds of symptoms and which did not exist with the previous version of XBMC.

It seems that a new release of XBMC will be coming along soon, so I assume that those who are more determined than I am to play DVDs right now would have two choices — either install the previous version of XBMC, which should work properly, or wait until the next version is available.

For my part, I will be waiting for the next version, and in the meantime I am going to look at the new NOOBS release, and perhaps try making a 'native' installation of Raspbian and/or openELEC on a dedicated SD card.

Further reading

Related Topics:

Enterprise Software Open Source Developer Cloud

In order to enjoy more diverse media playback on your Raspberry Pi micro computer, you need to manually enable the MPEG-2 and VC-1 codecs. Read on to see how to do so and enjoy DVD playback and more on your Pi.

Why Do I Need To Do This?

The Raspberry Pi was designed to be an educational computer. As part of that educational mission, the Raspberry Pi Foundation has gone out of their way to minimize the manufacturing and licensing costs in order to keep the final cost of the device down. Part of their cost cutting measures included not purchasing a pricey blanket license to use the MPEG-2 and VC-1 video codecs.

This doesn’t mean the Raspberry Pi is not capable of decoding media encoded in MPEG-2 or VC-1, but that by default the codecs cannot run on the Raspberry Pi hardware for want of a proper license. Fortunately the Raspberry Pi Foundation was able to make arrangements to sell individual licenses for each codec very inexpensively.

If you’re wondering whether or not you’re the target audience for this license sale program and this tutorial, check to see if any of the following statements apply to you:

I’m using my Raspberry Pi as a media center and/or general purpose device and I wish to:

  • Watch DVDs (either straight from an attached DVD drive or from ripped .ISO files). In this case you need an MPEG-2 license to decode the video on the DVDs.
  • Watch my collection of AVI files. While AVI is technically a container format, not a codec, the vast majority of AVI files are encoded using MPEG-2 and as such you’ll need an MPEG-2 license.
  • Watch content I’ve ripped or recorded using Windows Media Center (such as movies or television shows in the WMV container format). For this you’ll need the VC-1 license.

If you’re unsure if you have the files types in question there are two simple ways to check. First, you can try to load the file in your Raspberry Pi media center. If the file is, for example, an MPEG-2 encoded video file there is a very high chance that the audio track will play just fine but the video track will fail to render, leaving the screen black.

The more precise way to check is to examine the file itself using a tool like MediaInfo—you can follow along with our MediaInfo tutorial here. MediaInfo will tell you the specific video codec for any video file you examine.

What Do I Need?

For this tutorial we’re assuming you’ve already got your hands on a Raspberry Pi unit and installed your operating system of choice on it. Further, we’ll be using a copy of Raspbmc for this tutorial under the assumption that many of our readers followed our Raspbmc guide and would now like to add in DVD/WMV support to their build.

Even if you are using another Raspberry Pi distribution, the command line instructions and the manual configuration are still applicable to you and your Pi unit.

We’ll be covering two methods: adding the license code manually and via Raspbmc—a popular Raspberry Pi-enabled distribution of XBMC.

To follow along you’ll need the following things:

License
  • An MPEG-2 (~$4)and/or VC-1 license(~$2) purchased from the Raspberry Pi store.
  • Access to the command prompt on the Raspberry Pi (either at the physical device or via SSH).

First, we will walk you through getting the serial number off the board and purchasing the licenses you need. After that, we’ll show you how to manually add the licenses to your Pi or use the built-in tool within Raspbmc.

Purchasing the Licenses

In order to purchase the licenses you need, you will have to retrieve the unique serial number for your Raspberry Pi board. This number is not printed anywhere on the circuit board but is instead stored in the hardware; it must be retrieved using the command prompt.

Retrieving the Serial Number: First, visit the command prompt either at the actual terminal or remotely connected to the terminal via an SSH tool such as PuTTY. If you have a keyboard attached to your Raspbmc machine, simply select “Exit” out of the Raspbmc interface via the power button in the lower left hand side of the GUI. Press ESC to load the command prompt instead of booting back into the Raspbmc GUI. This will deposit you at the command prompt.

Alternatively, if you would like to access the command prompt remotely, fire up your SSH client (such as PuTTY) and enter the IP address of your Rasperry Pi unit.

Whether you have pulled up the command prompt directly at the machine or via SSH you will be prompted to login. The default login/password combination for Raspbmc is pi / raspberry.

Once at the command prompt enter the following command: cat /proc/cpuinfo

Your Pi will spit back 11 lines of text, but the only one of interest to us is the last line labeled Serial. Copy the unique 16 digital serial number (partially obfuscated in the screenshot here).

Because the license is granted to each specific Raspberry Pi board, repeat the above process for all Raspberry Pi boards you wish to purchase a license for.

Once you have the the serial number for each individual unit, it’s time to purchase the licenses from the Raspberry Pi foundation.

Purchasing the License: Visit the Raspberry Pi foundation’s purchase page for the MPEG-2 license and/or VC-1 license. Enter your Raspberry Pi serial number in the appropriate blank beneath the price. Add the license to your cart. Repeat this process for all the licenses on all the units you wish to add the codecs to.

Although the foundation indicates that it could take up to 72 hours for your license to arrive via email, we received ours in about 24 hours. When your email arrives it will include a code for each license formatted like such:

decode_MPG2=0000000000

decode_WVC1=0000000000

The 0000000000 portion of the license is your unique 10-digit alphanumeric license code.

Installing the Licenses

Raspberry pi video codec

Now that we have the license codes, it’s time to add them to your Raspberry Pi and get to enjoying enhanced media playback.

Manually installing the licenses: The manual installation technique works for any installation on the Raspberry Pi, including Raspbmc.

To manually install the codecs, you need to power down your Raspberry Pi device, remove the SD card, and mount the SD card on a computer with access to a simple text editor.

Raspberry Pi SD cards include a FAT formatted mini partition that holds startup tools including an easily edited configuration file labeled config.txt. [Note: Some operating systems builds may not automatically create a config.txt file; if there is no config.txt simply create your own.]

Locate the file and make a copy, renaming it config.old—this version will serve as a backup in case anything goes wrong during the editing process. Open up the original config.txt in your text editor of choice (we’re using Notepad++).

Depending on what operating system you’re running on your Pi, the configuration file may look slightly different. Leave the existing entries alone. Cut and paste the formatted license entries you received in your email, like so:

Save the config.txt file and safely eject the SD card from your computer. Return the SD card to the Raspberry Pi and power up the device.

Adding the licenses via the built-in Raspbmc tool: If you’re running Raspbmc, you can skip the whole manually editing the config.txt step and take advantage of the built-in tool right inside Raspbmc.

To do so, head over to your Raspbmc device and navigate from the main interface to Programs –> Raspbmc Settings. Once you are inside Raspbmc Settings, navigate to the System Configuration Tab and scroll down to the the Advanced System Settings section:

There you can click on MPEG2 and VC1 and input your license number. Don’t type in the entire string provided for you by Raspberry Pi, leave off the leading decode_MPG2= and decode_WVC1= portion. Only input the 10-digit string after the equal sign into each codec’s respective slot.

Once you have added the appropriate codec licenses, head back to the main interface and reboot your device via the power selection menu in the lower left hand corner.

Testing the codecs: The most enjoyable way to test your new codecs is to fire up a media file you know wouldn’t play without it, sit back, and watch it play perfectly.

The more technical way to check, should you run into any hiccups and wish to confirm that your license is recognized by the device, is to head to the command prompt and enter the following commands:

vcgencmd codec_enabled MPG2
vcgencmd codec_enabled WVC1

The Pi should immediately return that the codec is enabled. Here’s the output for the MPG2 check on our test machine, for reference:

Raspberry Pi Mpeg-2 License

Everything looks good at the command prompt and the previously audio-only files now play both their audio and video channels. For a few bucks and a few minutes of our time, we’re ready to enjoy the wide variety of videos encoded in MPEG-2 and VC-1 codecs.

Have a pressing Raspberry Pi-related topic you’d love to see us address? Sound off in the comments or write in to tips@howtogeek.com with your suggestions.

READ NEXT

Raspberry Pi Video Codec

  • › What Does “NSFW” Mean, and How Do You Use It?
  • › How to Permanently Uninstall Microsoft Teams on Windows 10
  • › Six Common Smarthome Mistakes Beginners Make
  • › What Can I Do with My Old iPhone?
  • › Free Download: Microsoft’s PowerToys for Windows 10

Comments are closed.