Saturday, September 14, 2013

How to make Crystal HD accelerated video decoding work in Ubuntu

I have a small "nettop" Foxconn NT510 system which I use as a "TV computer", mostly to play videos. It has an Atom D510 process (1.7GHz dual-core Pineview) which isn't powerful enough to decode and play 1080p video, and sometimes even stutters with 720p video in fast-moving scenes.

Fortunately, it also has a built-in Broadcom Crystal HD BCM970015 chip, which is a mini-PCI card that supports hardware-accelerated video decoding and has good Linux drivers.

Getting the CrystalHD to work under Ubuntu 12.04 took a few steps, but now I can play 1080p video with CPU usage of about 10% of one core, using either Totem (GStreamer-based) or VLC media players. Here's how:

  • Install both the crystalhd-dkms and firmware-crystalhd packages. The former is the kernel module for the driver, while the latter is the firmware for the device:

    $ sudo apt-get install crystalhd-dkms firmware-crystalhd

    If you don't install the firmware package, you'll get weird cryptic errors in your syslog and it just won't work. For some reason the need for the firmware package isn't mentioned clearly in most of the tutorials I've seen.
  • If you want to use a GStreamer-based video player like Totem, install gstreamer0.10-crystalhd. Now, accelerated playback with GStreamer should "just work."
  • To make VLC use the CrystalHD is somewhat less obvious. Ubuntu's version of VLC does include the CrystalHD plugin but it does not try to use it by default. Three ways to do it:
    • Use vlc --codec crystalhd from the command line. Works, but you'll have to run it this way every time.
    • Open the VLC GUI, and choose Tools | Preferences from the menu, then Show ALL Settings. Choose Input/Codecs from the lengthy tree menu, and then scroll down to the bottom of the pane where Preferred decoders list appears. Add "crystalhd" to that field, and save your preferences.
    • Edit your VLC configuration file (normally ~/.config/vlc/vlcrc) and find the comment string "Preferred decoders list". Edit the following line to look like this:

      # Preferred decoders list (string)
      codec=crystalhd

In any case, to verify that the CrystalHD is actually being used, start playing a video and watch your syslog (e.g. tail -f /var/log/syslog in a terminal window). You should see a line like this when you start playing video:

crystalhd 0000:04:00.0: Opening new user[0] handle

No comments:

Post a Comment