Oh, The Huge Manatee

A blog about technology, open source, and the web... from someone who works with all three.

Heat Issues on My XBMC Mediacenter

I run an XBMC mediacenter at home, on my old Compaq C765 laptop (the laptop I used to use as a Hackintosh, until I got a real Mac).  I say it’s old, but it’s perfectly well powered:

  • 2.1ghz Intel Core 2 Duo
  • 2gb RAM
  • Intel GMA X3100 “graphics” adapter
Apart from the X3100, it’s a perfectly good little computer, and perfect for a media center.  XBMC is super easy to install - just install Ubuntu as you normally would, and install the XBMC package using your favorite package manager (“apt-get install xbmc” will do it).

What’s great about XBMC is that all the configuration is through the TV graphical interface.  No pain in the ass backend to configure (I’m looking at YOU MythTV), it just works.  I like that.  

The real pain in the ass though, came when I wanted to play HD movies.  The whole point of having a mediacenter is to keep all your movies and TV shows on a hard drive, so I ripped a couple of my favorite Planet Earth episodes in HD, and gave it a shot.  Unfortunately, Ubuntu’s built in HD video decoder (libavcodec/ffdshow/ffmpeg) requires too much power for my little mediacenter.  I couldn’t get through the intro without seeing significant lag behind the audio,and ultimately tons of dropped frames.

On Windows, the solution is simple - get a commercial HD decoder software package.  CoreAVC has a reputation as the best in the business.  This is partly because it’s multi-threaded, and partly just because it’s so well written!  Most people see at least a 30% gain in their framerates with this decoder.

As I mentioned though, it’s commercial. I don’t like paying for software on a gamble, so I tried downloading the 14 day trial to play with at first.  These instructions should work with the trial… I just ran a few benchmarks on one of my other systems, and was satisfied enough to pony up the $15.  Here are the steps I followed (For Ubuntu 9.10)

  1. Install the tools you need to build mplayer over again, and to build coreavc-for-linux:
    sudo apt-get install subversion build-essential xorg-dev pkg-config gcc-4.3 wine
    (honestly you shouldn’t need to explicitly install gcc-4.3 unless you upgraded from karmic like I did - badly)
  2. Make a directory to work in, and download the sources you need:
    mkdir ~/cursing
    cd ~cursing
    svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
    svn checkout http://coreavc-for-linux.googlecode.com/svn/trunk/ coreavc-for-linux 
    Also download CoreAVC!  As I mentioned, I only ever tried this with the registered version, but there’s no reason you shouldn’t be able to do it with the shareware version as well. 
  3. Install CoreAVC using WINE (you don’t run it using WINE, but you do have to install it to pull out the library!)
    wine “~/Desktop/CoreAVC Professional Edition-x.x.x_Setup.exe”
    This is where you get to enter your serial number, or deal with the demo.  The installer will work just like a windows installer, because Wine is just that badass.
  4. Install DShowServer:
    cd dshowserver/precompiled
    make install
  5. Copy your freshly installed CoreAVC library into the dshowserver directory so it’s easy to find:
    sudo cp “~/.wine/drive_c/Program Files/CoreCodec/CoreAVC Professional Edition/CoreAVCDecoder.ax” /usr/local/share/dshowserver 
At this point you should take a break.  Hey, that was a lot of work!  Get a coffee, put on some music or something.  And you can feel good about the progress you made!  Look at that, dshowserver can find and load CoreAVC:  
dshowserver -c CoreAVCDecoder.ax
No id specified, assuming test modeOpening device
len
: 992
ProductVersion: 2.0.0
Decoder supports the following YUV formats: YUY2 UYVY YV12 I420 Decoder is capable of YUV output (flags 0x2b)
Setting fmtStarting
Initialization is complete
That’s like half the battle, right there!  

Now that your legs are stretched, let’s get mplayer using this new shiny codec.

  1. Mplayer out of the box doesn’t support dshowserver, so we have to patch the source a little:

    cd mplayer-source-dir 
    patch -p0 < ../coreavc-for-linux-source-dir/mplayer/dshowserver.patch
  2. Compile and install mplayer from this patched source:
    make && make install
  3. Now you just have to add the new codec to your ~/.mplayer/codecs.conf and you’re away to the races!  Add these lines to the end of codecs.conf :
videocodec coreserve info “CoreAVC DShow H264 decoder x.x for x86 - http://corecodec.org/”
  status working
  format 0x10000005
  fourcc H264,h264 H264
  fourcc X264,x264
  fourcc avc1,AVC1 AVC1
  fourcc davc,DAVC
  fourcc VSSH
  driver dshowserver
  dll “CoreAVCDecoder.ax”
  guid 0x09571a4b, 0xf1fe, 0x4c60, 0x97, 0x60, 0xde, 0x6d, 0x31, 0x0c, 0x7c, 0x31
  out YV12,IYUV,I420,YUY2

You do have to explicitly tell mplayer to use this codec on launch - use
mplayer -vc coreserve
To get it to start.  Have fun!  My little lappy runs great, smooth HD video!

Comments