UPDATE (20-Aug-2009): The bulk of the patch has now been committed to XBMC in revision 22285. A few extra goodies added to the patch now. Might cause some conflicts once these are committed, but that might not be for a week or more.
UPDATE (18-Aug-2009): A recent update of ffmpeg in XBMC (revision 21993 on 04-Aug-2009) meant that the original patch and instructions no longer worked. The instructions below have been updated and a new patch released. Much of the original patch is now directly in XBMC Media Center due to the ffmpeg update so it is much smaller.
I maintain the Myth TV page in the XBMC wiki. Some people in New Zealand have contacted me to get instructions on what needs to be done to get recorded Freeview|HD content playing in XBMC from a Myth TV backend.
Well, here those instructions are. Luckily there isn’t as much voodoo magic as there used to be. There will be even less voodoo once some of my other patches make it into XBMC proper, and Paul Kendall’s patches for LATM encapsulated AAC decoding finally wiggle their way into ffmpeg.
These instructions assume:
- You already have Myth TV working as expected with the digital terrestrial Freeview|HD broadcast. Getting this working isn’t covered here. Go to Myth TV NZ as a starting point or join the mythtvnz mailing list for more information.
- You have seen the light and are using Linux and not Windoze
- You have a level of confidence with Linux
- You are happy to compile XBMC Media Center from source code (and have some concept of what compiling is)
- You have a smoking fast CPU. A dual core 3.0GHz or faster CPU is needed or an nVidia video card / chipset that supports VDPAU. Decoding 1080i H264 content from TV3 is super CPU intensive or needs to be offloaded to the GPU.
The New Zealand Freeview|HD digital free-to-air transmission DVB-T video stream uses the H264 codec (along with PAFF interlacing for TV3). The DVB-T audio stream uses either AC3 or LATM (Low-overhead MPEG-4 Audio Transport Multiplex) encapsulated HE-AAC. The audio and video streams are transmitted within an MPEGTS container.
Without further ado:
- Install Subversion.
$ sudo apt-get install subversion - Change to a directory where the XBMC source code will be downloaded to (a new directory called XBMC will be created after this step).
- Download the XBMC Media Center source code from SourceForge using subversion. This will create a directory called XBMC that contains the source code for the linuxport version of XBMC. This step will take a while as all the source code downloads.
$ svn co https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/XBMC XBMC - Once finished, change to the new XBMC directory.
$ cd XBMC - Install build / compile dependencies. Follow the instructions in the README.linux file to obtain all the build dependencies.
- Remove pulse audio (optional) I strongly recommend removing pulse audio as ALSA audio works fine. I had nothing but problems trying to get pulse audio to work. The step below is optional but strongly recommended:
$ sudo aptitude remove libpulse-dev - Install libfaad
$ sudo aptitude install libfaad-dev - Download the latest Freeview|HD patch file to the XBMC directory.
$ wget http://s3.teirney.net/xbmc/freeview-hd-linuxport-r22286.patch
The remaining areas from the original Freeview|HD patch have been removed pending further testing of the mpegts seek handling improvements added directly to the XBMC source tree. The updates to mpegts file handing to continue playing after seeking if there is a timestamp discontinuity within the mpegts container have also been removed pending further testing with the seeking changes directly in XBMC. The Freeview|HD patch used to bundle the patches attached to ffmpeg issues 1128 and 452. You can apply these patches from ffmpeg directly if you have any problems with playback stopping when trying to seek (let me know here if you do as well). The remaining patches in the original Freeview|HD patch have already been committed to XBMC or will be committed shortly. Below are some of the goodies. If you have any conflicts with future updates, revert the file that conflicts.- Correct frame rate detection for 1080i TV3 so the commercial breaks are automatically skipped in the correct place (if flagged correctly by mythcommflag)
- Tweaks to reduce the amount of time it takes to start playing MythTV files - this will depend on your MythTV configuration, but helps immensely for me with a Nova T 500.
- Another tweak to help better determine if something is a movie if using the movie length HACK, which I don’t think I’ve documented yet.
- Revert any existing Freeview|HD patches. Any existing Freeview|HD patches need to be reverted prior to applying this new patch (in fact any existing patches wouldn’t have worked after the big ffmpeg update in XBMC). This step is only needed if you have installed a previous Freeview|HD patch.
$ svn revert -R .
$ make distclean - Install the NEW Freeview|HD patch.
$ patch -p0 < freeview-hd-linuxport-r22286.patch - Configure the XBMC source tree enabling external libfaad support. This will take some time (~5 minutes). External libfaad support is needed to decode the HE-AAC content and turns on the LATM handling.
$ ./configure --enable-external-libfaad - Make XBMC. This will take longer (~15 minutes).
$ make - Install XBMC
$ sudo make install
Hopefully that’s all gone smoothly. Now you should be able to follow the instructions on the XBMC wiki for Myth TV to get the out-of-the-box Myth TV integration in XBMC up and running.
Any problems, kudos, whatever. Leave a comment.
Dave,
Thanks for the info, will be trying to make time to see if I can get this running. Did you consider using a packaged libfaad2 (ie https://launchpad.net/~freshmedia/+archive/ppa) or is it better to use the source?
Packaged libfaad2 2.7 should work fine. I just took the first thing I found - which was the source. If the PPA works out for you let me know and I’ll change the instructions. Makes things heaps easier. That PPA also includes recent builds for ffmpeg as well. Will check what options they used for the compile - might be able to use that as well once the LATM patches are finally committed.
libfaad0 (2.6.1-3.1) from the ubuntu universe repos contains libfaad.so.0
libfaad0 (2.7) from that ppa contains
/usr/lib/libfaad.so.2
/usr/lib/libfaad.so
/usr/lib/libfaad.so.2.0.0
And mythtv-backend fails to install with “/usr/bin/mythbackend: error while loading shared libraries: libfaad.so.0: cannot open shared object file: No such file or directory”
Is 2.7 backwards compat? Would a symbolic link allow myth to function?
Was able to use libfaad0 from the freshmedia ppa and compile xbmc, but had to create a symbolic link from libfaad.so.0 to libfaad.so.2.0.0 (both libfaad.so.2 and libfaad.so were already links to libfaad.so.2.0.0).
However, not currently able to use the ffmpeg from freshmedia as that is dependant on libfaad2, which isn’t compatible with the avenard mythtv-21-fixes packages. Not sure if it would have had the ts changes, but there were built only a couple of days away.
Just have to get home and test it now.
This patch for XBMC is still using the internal source for ffmpeg. You need to ./configure XBMC using — enable-external-ffmpeg to use an external ffmpeg, and the external ffmpeg needs to have the LATM encapsulated HE-AAC patches applied and be configured to have libfaad enabled. There’s also a Segmentation Fault issue with XBMC when seeking in some mpegts streams with the current SVN version of ffmpeg. What is in this current patch is the best I can get working at present.
Yep I understand that, just saying that the freshmedia ppa has a few dependancy issues for their ffmpeg packages in case you were wondering if it may be usable later once it has the TS stream patches applied (I don’t understand the relationship between the libfaad0 and libfaad2/libfaad2-0 packages).
Thank you for the patch, it works well, I’m very grateful. No problems at all with sound.
Video quality isn’t the best still for both recorded tv and live tv; faster movement looks horrible, like it’s dropping frames - very noticable with arm movements. With mpegts changes coming I suspect my best plan is to wait and let things evolve.
I get really smooth playback even with the TV3 1080i HD content. I’m running an AMD X2 6000 CPU (dual core 3.0GHz). That just keeps up with the 1080i content with the skiploopfilter turned on. You can read more about turning on the skiploopfilter at http://www.xbmc.org/wiki/?title=MythTV#Audio_Plays_Out_of_Sync. If you bring up the information while playing a recording you should be able to see the CPU utilization. If either CPU is on 100% you’ll have playback issues.
There’s another patch available that can be used so the skiploopfilter is only turned on for the 1080i content (my machine doesn’t need it for 720p). http://xbmc.org/trac/ticket/6083. This is not in the Freeview|HD patch.
There’s yet another patch available that can be used to automatically select the AC3 audio stream for TV3 (http://xbmc.org/trac/ticket/5773). This is also not in the Freeview|HD patch.
I’m running an AMD X2 4800 CPU (dual core 2.5GHz), but the xbmc overlay is saying it’s using vpdau and cpu is at about 3%, so I assumed it was related to the mpegts issues.
I’ll play with it some more and see if I can stop it happening, or at least describe it better. I think c4 was not showing that behaviour, at around 3Mbit/s, whereas tv 1/2/3 was around 13Mbit/s? Is it possible it’s just sheer I/O load? Although that would reflect in a higher cpu% maybe.
Sound was in sync but will look at that skiploopfilter, thanks.
Could be IO to the graphics card. Check the VDPAU related thread(s) on the XBMC Linux forums. There was some discussion about the minimum amount of memory that the card needed access to for Full HD playback. IIRC it was at least 256Mb - has definitely been covered in the forums though.
David - are you also getting negative bitrates for audio streams for LATM, and aq figures around 20-30? Vq figures are solid at 99.
This is without trying the skiploopfilter tip. Card is a 512Mb 9400gt silent, so it should be fine - there’s no issues with other 1080 content.
Hi Dave,
Thanks for your article, it really helped me get set up. The instructions worked a treat, got me up and running and getting freeview HD playing in xbmc
I’m gonna have a look at the VDR integration when I get some more time, although this is good for now.
Cheers,
Alex
Greg, Alex, feedback at http://xbmc.org/forum/showthread.php?t=52894 would be appreciated. Not sure which skin you are using. I’m using Aeon Auriga after shifting from MediaStream.
I have just tried to run through the instructions. Downloading the source took 4 hours so I hope I can get past the problems I am having in installing.
Firs issue is that I got an error that 1 out of 2 hunks of the patch patch failed. More specifically Hunk #2 FAILED at 1219.
Even so I proceeded to ./configure — enable-external-libfaad
where I got configure: error: Could not find a required library. Please see the README for your platform.
So I read the XBMC readme for Ubuntu and ran
# sudo apt-get install subversion make g++ gcc gawk pmount libtool nasm automake cmake gperf unzip bison libsdl-dev libsdl-image1.2-dev libsdl-gfx1.2-dev libsdl-mixer1.2-dev libsdl-sound1.2-dev libsdl-stretch-dev libfribidi-dev liblzo-dev libfreetype6-dev libsqlite3-dev libogg-dev libasound-dev python-sqlite libglew-dev libcurl4-dev x11proto-xinerama-dev libxinerama-dev libxrandr-dev libxrender-dev libmad0-dev libogg-dev libvorbis-dev libmysqlclient-dev libpcre3-dev libdbus-1-dev libhal-dev libhal-storage-dev libjasper-dev libfontconfig-dev libbz2-dev libboost-dev libfaac-dev libenca-dev libxt-dev libxmu-dev libpng-dev libjpeg-dev libpulse-dev mesa-utils libcdio-dev libsamplerate-dev
I got
subversion is already the newest version.
make is already the newest version.
make set to manually installed.
g++ is already the newest version.
g++ set to manually installed.
gcc is already the newest version.
gcc set to manually installed.
gawk is already the newest version.
gawk set to manually installed.
pmount is already the newest version.
pmount set to manually installed.
libtool is already the newest version.
automake is already the newest version.
unzip is already the newest version.
unzip set to manually installed.
Note, selecting libsdl1.2-dev instead of libsdl-dev
libogg-dev is already the newest version.
libogg-dev set to manually installed.
Note, selecting libasound2-dev instead of libasound-dev
libasound2-dev is already the newest version.
python-sqlite is already the newest version.
python-sqlite set to manually installed.
Note, selecting libglew1.5-dev instead of libglew-dev
Package libcurl4-dev is a virtual package provided by:
libcurl4-gnutls-dev 7.18.2-1ubuntu4.3
You should explicitly select one to install.
E: Package libcurl4-dev has no installation candidate
I then tried to ./configure — enable-external-libfaad again but still get the same error about the missing library.
I would really appreciate any help on the patch error and the missing library error.
Steve, the patch failing is because one of my patches was recently commited to the source tree (with some tweaks). Please check the updated instructions in the post (prefixed with UPDATE).
The last problem should be rectified using:
$ sudo apt-get install libcurl4-gnutls-devHi David,
Thanks for your help. I really missed that not about the update, I must read more carefully.
I did sudo apt-get install libcurl4-gnutls-dev and it installed correctly.
Unfortunately I am still getting the same error about a missing library (would be great if the error gave a list of missing libraries).
Do you have any idea how to proceed from here?
Steve, you didn’t miss the update. I added it after you had problems
If you paste the last 100 or so lines of output from configure to http://pastebin.com and post the link here I will have a look.
I have pasted everything after the configure command.
http://pastebin.com/m1ab94d7b
Cheers
Steve
It can’t find libboost-dev. That’s after libcurl4-dev in the huge list in the README.ubuntu file. Suggest you try and do that massive sudo apt-get again. It might have stopped once it got to libcurl4-dev and didn’t know what to do. If you have problems with that large line again, replace libcurl4-dev with libcurl4-gnutls-dev.
Thanks David, I reckon you are probably correct (that it just stopped on that error). I have since used the second method in the README.ubuntu to get the build dependancies sudo apt-get build-dep xbmc. Configure has now completed and I am on to make.
Thanks for writing such a clear description of how to go about this. Even though I have had a couple of minor problems with my build, your guide and support has made it very easy to get through each stage.
XBMC is installed. But I now have no sound. I start xbmc from a terminal and I get
The XBMC_HOME environment variable is not set.
ALSA lib pcm_params.c:2135:(snd1_pcm_hw_refine_slave) Slave PCM not usable
Then if I try to watch a movie I get a warning “failed to initialize audio device” I checked my audio settings but I really don’t know what to change. I have it set to analogue and device is default.
I previously installed from a PPA and I had sound in xbmc (except not for TV1 and TV2 recordings).
My MythTV front end has sound setup is: output audio device /dev/dsp, passthrough device - default.
Sorry to be such a pain - can you suggest anything I can try.
Steve, not sure. Not something I have run into. Perhaps try searching the XBMC Linux Support Forums and see if anyone else has had a similar problem. If not create a new thread.
Hi, thanks for this patch.
I’ve had trouble trying to get it working though, I’m not sure if a recent commit has caused it or if it’s because I’m using gentoo (somewhere in the makefile or configure it mentions the external-lib-faad switch and gentoo so it sounds like it might not work).
I have previously had LATM working with the patches on the trac but that patch stopped applying cleanly, probably after r21095, and I haven’t got it working again since. I tried modifying the patch to revert that commit, I tried using the internal libfaad as I did when it worked before (along with the LATM patches obviously), but I still get no audio on channels other than 3.
Have you got any ideas?
Thanks,
Brinn
Hi Brinn, it should all work on Gentoo as long as the external libfaad library is installed. Since this post XBMC has been updated so libfaad 2.7 is no longer required. In theory you should be fine installing libfaad-dev.
$ sudo apt-get install libfaad-devIf you post the last 100 or so lines of output from
$ ./configure --enable-external-libfaadto http://pastebin.com I’ll have a look.UPDATE: I have started moving the EDL patches into the XBMC source tree. If you update before I’m finished you’re likely to get masses of conflicts!
UPDATE 2: Actually I never put any of the commercial skip stuff into the patch I uploaded so things should be fine. I am definitely getting older, I should be able to remember things like this!