How to play MKV H264 X264 video files using CoreAVC in Xine Player

From LinuxMCE wiki

Jump to: navigation, search


This page explains how to achieve successfull playback of Mkv/H264/X264 files on Linuxmce.

This procedure was tested on a Media Live system with a AMD X2 4800+ CPU and using the onboard 6150 Nvidia chipset, playing a 1080p action movie. Using Xine_Player (or even Mplayer) the CPU was being used at 100% making the movie unwatchable (stuttering, frame drops) while the CoreAVC method keeps the CPU hovering around 70% and no slow down or skipped frames even during the most intense scenes. The information is current as of July 2008. The procedure needs to be done on every MD where H264 support is required.

Pros: Allows playback of MKV/H264/X264 content, uses the existig Xine implementation which supports pausing, fast forward etc (no messing with Mplayer, no loosing of functionnality)

Cons: Uses the commercial CoreAVC decoder which costs $15 to license. Well worth it in my opinion for those requiring this feature. A free 14 day trial is also available.

On your MD (I did this as root. If you're not root, you may need to sudo in various places and/or run into problems):

1) Download the coreavc-for-linux code from svn:

svn checkout http://coreavc-for-linux.googlecode.com/svn/trunk/ coreavc-for-linux

2) Download dshowserver-ia32-r63-gentoo.tar.bz2 from this page. (Versions prior to r30 did not support the latest version 1.70 of CoreAVC, and versions r33 and r46 had a bug causing a green screen and no video playback)

3)

tar -xjf <path/to/>dshowserver-ia32-r63-gentoo.tar.bz2
cd dshowserver
cp dshowserver /usr/local/bin
cp ../loader/registercodec /usr/local/bin

4) Get the CoreAVC decoder from here. Install it on a windows machine, find the file CoreAVCDecoder.ax and put it in /usr/lib/win32/CoreAVCDecoder.ax on your MD. Feel free to start with the free 14 day trial version. This was tested with version 1.7.0 and 1.8.0. More recent version may require different combination of dshowserver and/or libxine

5) Register CoreAVC

export REGISTRY=$HOME/.mplayer/registry32

If using the paid version:

registercodec -r $REGISTRY -k"HKLM\\Software\\CoreCodec\\CoreAVC Pro\\Serial" -v "55555-55555-CORE-55555-55555"

If using the trial version:

registercodec -r $REGISTRY -k"HKLM\\Software\\CoreCodec\\CoreAVC Trial\\Serial" -v "55555-55555-CORE-55555-55555"

Subsitute 55555-55555-CORE-55555-55555 with the serial number you get from CoreAVC when downloading the application.

6) Verify that dshowserver is working

dshowserver -c CoreAVCDecoder.ax -s 1280x720 -g 09571a4b-f1fe-4c60-9760de6d310c7c31 -b 12 -f 0x34363248 -o 0x30323449

Should return:

No id specified, assuming test mode
Opening device
len: 992
ProductVersion: 1.7.0
Decoder supports the following YUV formats: YUY2 UYVY YV12 I420 
Decoder is capable of YUV output (flags 0x2b)
Setting fmt
Starting
Initialization is complete

If you get an error message saying "permission denied", try chmod a+x /usr/local/bin/dshowserver first

7) Now we need to recompile libxine so that Xine_Player will use CoreAVC via dshowserver to play H264 files. Setup a development environement using these instructions (may take a while)

8)

cd charon-merge/ubuntu/xine-lib-1.1.10.1 #(using any older or newer version of xine-lib did not work for me. Xine was ignoring dshowserver)
patch -p1 <path/to/coreavc-for-linux/xine/dshowserver.patch
./configure
make
make install

9) libxine is now installed in /usr/local/lib, but Xine_Player uses the library in /opt/libxine/lib (and Xine or Kaffeine from KDE use the one in /usr/lib in case you need it).

cd /opt/libxine/lib
rm libxine.so.1
ln -s /usr/local/lib/libxine.so.1.19.0 libxine.so.1

10) Now you need to restart Xine_Player. The easiest way to do that is probably to restart the MD. Now try playing a MKV/H264/X264 movie, and if you're lucky, it should work!

Credits: Some instructions above copied from the coreavc-for-linux project

TODO: CoreAVC could also be used in MythTV according to the coreavc-for-linux project. I do not know if this is necessary and which improvements it would bring to watching channels in HD.