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

From LinuxMCE
Jump to: navigation, search


THESE INSTRUCTIONS ARE ONLY TO BE USED FOR 710. WITH 810 THEY BECOME OBSOLETE THANKS TO THE VDPAU SUPPORT. IF YOU HAVE PROBLEMS PLAYING BACK CERTAIN CONTAINER TYPES, SEE HERE Play mkv files

This page explains how to achieve successful 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 on-board 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 existing 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.

Viking: VDR will not work after doing this. The libxine is somehow not right :( Hoping to find a solution.

Installation

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):

  • Download the coreavc-for-linux code from svn:
svn checkout http://coreavc-for-linux.googlecode.com/svn/trunk/ coreavc-for-linux-read-only
  • 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)
tar -xjf <path/to/>dshowserver-ia32-r63-gentoo.tar.bz2
cd dshowserver
cp dshowserver /usr/local/bin
cp ../loader/registercodec /usr/local/bin
  • 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. (Note that the more recent versions 1.8.5 and 1.9.0 do not work on my system. The symptoms are that the video file will start playing, but then lock up during the first few seconds of playback.)
  • Register CoreAVC
export REGISTRY=$HOME/.mplayer/registry32
mkdir $HOME/.mplayer
    • 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.

  • Verify that dshowserver is working
chmod a+x /usr/local/bin/dshowserver 
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
  • Now we need to recompile libxine so that Xine_Player will use CoreAVC via dshowserver to play H264 files.

Setup a development environement:(may take a while)

apt-get install subversion build-essential ccache
svn co http://svn.linuxmce.org/svn/trunk #this will take a while
cd trunk
./configure
make #this will take several hours

IMPORTANT: You do need to follow the procedure above. Don't try to just compile xine-lib. It will complain about some libraries missing, and if you fix the dependencies, it will then compile, but the libraries will not be the correct versions and xine-lib will ignore dshowserver. Therefore it is important to compile the entire LMCE source, which will install libraries in the required versions, by following the instructions above. When done, we are ready to modify and compile xine-lib:

cd <destination-dir of svn checkout>
cd 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
automake-1.9
./configure
make clean
make
make install

Here are some things you can do to check that you have done it right.

After "make" you should be able to find the following files below "ubuntu/xine-lib-1.1.10.1" :

# find . -name "*dshow*"
./src/libxinevdec/dshowserver.lo
./src/libxinevdec/.deps/dshowserver.Plo
./src/libxinevdec/dshowserver.c
./src/libxinevdec/.libs/xineplug_decode_dshowserver.lai
./src/libxinevdec/.libs/xineplug_decode_dshowserver.soT
./src/libxinevdec/.libs/dshowserver.o
./src/libxinevdec/.libs/xineplug_decode_dshowserver.so
./src/libxinevdec/.libs/xineplug_decode_dshowserver.la
./src/libxinevdec/xineplug_decode_dshowserver.la

And after "make install" :

# find /usr/local/lib/xine/ -name "*dshow*"
/usr/local/lib/xine/plugins/1.1.10/xineplug_decode_dshowserver.so
  • 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
  • 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.