[mythtv] Using CoreAVC with myth (better h264 performance)

Alan Nisota alannisota at gmail.com
Fri Apr 14 01:35:16 UTC 2006


In order to be able to view h264 encoded material in HD on my machine,
I have been searching for a solution.  ffh264 is too slow to handle
720p on my 2.8GHz P4, which I use as my frontend.  I thought I was out
of luck, until someone pointed out CoreAVCDecoder, which is a
DirectShow filter for Windows, and can play HD h.264 material capably
on my hardware.  the only problem was, of course, that it only exists
for Windows.  Well, mplayer can use DirectShow filters, so i thought
perhaps I could use that to play my videos in linux.  Of course, the
directshow capability in mplayer is basically unsupported, and
coreavcdecoder didn't work out of the box.  After a bit of mucking
around though, I was able to get it working.  And then the CoreCodec
team released version 1.0, which does much more significant input
validation, as well as including a registration key, and some other
difficulties.  After a lot more work, I was able to get 1.0 working
with mplayer as well.  I then moved on to incorporating the decoder
into myth, which turned out not to be difficult at all.

So, I now have myth using a Windows DirectShow filter to playback H264
media, and it is actually able to do so in real time with HD content!

I am not sure what the myth developers' take on this will be.  The
interface code is all based on wine, and is GPL, however the actual
driver is non-free (costs between $10 and $20 depending on which
version you buy).  the old codec 0.0.4 is still meandering about the
net, but I would expect that without a license it cannot be legally
redistributed.

the directshow code could certainly be made to work with other filters
as well, though, in general, the free codecs are good enough, so there
is no need.  Also, since libavformat is still used to split the
streams, it is unlikely it would be useful for handling codecs that
aren't available in ffmpeg.  If there is any interest in getting this
type of functionality into myth, I'll be happy to clean up the patches
and submit them, though.

So, with all that in mind, here is what I've got:

apply the patch located here:
http://www.files.bz/files/9309/Mythtv/directshow.patch.20060413.bz2

copy the following file into ~mythtv/.mythtv (or whatever user runs
the forntend):
http://www.files.bz/files/9309/Mythtv/dshowcodecs

Purchase CoreAVCDecoder (coreavc.corecodec.org) and install via wine
(or if you already have 0.0.4 you can use that instead).
copy CoreAVCDecoder.ax to /usr/lib/win32/
edit dshowcodecs and change the user-id and product-key to the values
found in your wine registry (~/.wine/system.reg)

from your mythtv dir:
cd libs/libdshowloader && make && cd dshow && make && cd ../../..
build myth as usual.

You should be good to go.
Caveats:
It is likely to only work with linux and gcc/glibc, as I played some
tricks with the exception handler in order to load the module.
It has only been tested on 32bit machines, I have no idea what will
happen if you try to compile on a 64bit one.
The code is still very rough.  a lot of work would be needed to make
it copile without warnings and as a proper library
Because we are using a binary, if it crashes, it is likely there is
nothing I can do to help.

If you are interested in the mplayer version, it can be found here:
http://www.files.bz/files/9309/Mythtv/mplayer_coreavc.patch.20060413.bz2
you need to directly edit DS_VideoDecoder.c and add your user-id/key
there (search for 'Joe User' to find where), and you need to add
something like this to your codecs.conf file:
videocodec coreavc
  info "CoreAVC DShow H264 decoder for x86 - http://corecodec.org/"
  status untested
  format 0x10000005
;  format 0x31637661 ; avc1
  fourcc H264,h264
  fourcc X264,x264
  fourcc avc1
  fourcc davc,DAVC
  driver dshow
  dll "CoreAVCDecoder.ax"
  guid 0x09571a4b, 0xf1fe, 0x4c60, 0x97, 0x60, 0xde, 0x6d, 0x31, 0x0c,
0x7c, 0x31
  out YV12,IYUV,I420,YUY2


More information about the mythtv-dev mailing list