— type: post layout: post meta: _edit_lock: “1275866496” _edit_last: “1” title: New Zealand Freeview|HD running on XBMC from Myth TV tags: - MythTV - Tips and Tricks - XBMC Media Center published: true status: publish — 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.patchThe 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).
$ 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.