Archive for the ‘MythTV’ Category

New Zealand Freeview|HD running on XBMC from Myth TV

Monday, June 8th, 2009

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.
 (more…)

Fix for XBMC MythTV script database connection failure after MythTV upgrade on (K)Ubuntu

Saturday, November 24th, 2007

I don’t understand why the password for the mythtv MySQL database user is reset whenever the MythTV package is updated in Ubuntu (and it’s derivatives like Kubuntu).

When this happens the Xbox Media Center (XBMC) fails to connect to the database. It’s somehow related to the password authentication mechanism that the MySQL libraries use on the XBox within XBMC.

Here are the instructions from one of my older posts to get the XBMC MythTV script to be able to connect to the MythTV database again. These steps are performed on the MythTV server.

  1. Login to MySQL as the root user - mysql -u root -p
  2. SET PASSWORD for mythtv = OLD_PASSWORD('mythtv');

Use the appropriate password for the mythtv user - the default is mythtv.

MythTV server now starts up and shuts down automatically

Friday, June 8th, 2007

I’ve spent the last few nights playing with the wonderful world of Linux Advanced Configuration and Power Interface (ACPI) so that the MythTV server will now automatically start up to record a scheduled TV show, and automatically shut down afterwards if there are no logged in users.

This is pretty cool because it means I won’t miss recording any more of the Americas Cup Highlights because I didn’t get out of bed early enough to turn on the server.

It was a pretty arduous task with a number of steps based on content from a number of different web-sites to get things to work. After all the research though it’s not actually that complicated to setup. At a high level the following was done (subsequent blog posts will cover off some of the more tricky bits in more detail):

  1. Configure Power Management in the BIOS of your machine to allow being resumed by alarm
  2. Install appropriate bits for Linux to support ACPI
  3. Alter the Linux configuration so the BIOS uses local time rather than UTC time (since MythTV works using local time)
  4. Ensure that the ACPI alarm interface works as expected when set
  5. Create a small script to set the ACPI alarm given a date
  6. Create a small script to check to see if it is OK to shutdown the server
  7. Configure MythTV to use the two scripts created above
  8. Alter the sudo permissions for the MythTV user so the scripts can be executed without permission problems
  9. Alter the login permissions so only root can shut the server down (to prevent accidental shutting down when the server is recording

Updated EPG instructions for MythTV in New Zealand

Friday, June 8th, 2007

I’ve been learning a bit more about Linux over the last few weeks and updated my electronic program guide (EPG) configuration to better reflect “standard” file location usage. The changes work better for my backup strategy as well as I do not backup any directory that starts with a dot.

  1. The location of the EPG script has changed. The EPG related scripts are now in the /home/mythtv/epg directory. Within that directory are two further directories. One for the old xmlTVNZ EPG configuration and the other for the new nice EPG configuration.
  2. The name of the EPG script has been changed. It is now simply called nice.sh and lives in the /home/mythtv/epg directory.
  3. The nice.sh script has been modified to log to the /var/log/mythtv directory:
    cd /home/mythtv/epg/nice
    wget http://nice.net.nz/epg/listings.xml.gz
    gunzip -f listings.xml.gz
    rm /var/log/mythtv/mythfilldatabase.log
    mythfilldatabase --no-delete --file 1 -1 listings.xml --update > /var/log/mythtv/mythfilldatabase.log

Setting up an EPG for MythTV in New Zealand

Monday, May 14th, 2007

One of the most important things to get right for your MythTV installation is the Electronic Program Guide (EPG). The EPG lets MythTV know when all of the programs are on so it know when to record your favourite show like “The Best of Top Gear”.

I’ve been using xmlTVNZ for some months now reasonably successfully. xmlTVNZ is a command line tool that scrapes various web-sites for the TV listings. The specific web-sites that are scraped depend on the command line parameters passed to it, which depend on which channels you are interested in getting EPG data for. Because of it’s scraping nature, it’s prone to falling over when a web-site that it scrapes changes. I think that problem may of occurred last night because all of the TV3 listings going forward disappeared. I managed to eventually get it working again by modifying the command line parameters to scrape TV3 off the Sky web-site instead of XTRA (which now appears to be Yahoo!).

I’ve also belonged to the Myth TV in NZ mailing list for some months and recently there was talk of some other common EPG methods. At the time I didn’t look into it because xmlTVNZ had been working fine. Given the recent problems though I looked into both the “Hairy” and “Nice” EPG listing methods.

The “Hairy” EPG is located at http://hairy.geek.nz/epg/ but when I looked last night there was some other strange directory listing there. The “Nice” EPG is located at http://nice.net.nz/epg/ and was all up when I looked last night. Both the Hairy and Nice EPG’s are based of the DVB program guide broadcast by Sky. The Nice one appears to have at least better information than obtained by xmlTVNZ because after updating there was lots of information updated after running mythfilldatabase for the same number of days.

Below is a set of instructions for getting the Nice EPG running within MythTV. This just covers the analog stations that I am recording since I don’t have a satellite dish installed but should work for any set of stations that you are tuning.

  1. Login as the mythtv user.
  2. Open the /home/mythtv/.mythtv/ directory
  3. Create a new directory called epg in that directory. This new directory could be created anywhere within the mythtv users home directory. I just put it in the .mythtv directory so it’s out of the way and next to the other MythTV related configuration directories like channels, which contains my channel icons.
  4. Create a new shell script file called nice.net.nz.sh in the epg directory. This will be used to script the download of the Nice EPG and to then populate the MythTV program database. This script could be named anything you like.
  5. Populate the newly created shell script with the following:
    #!/bin/bash
    wget http://nice.net.nz/epg/listings.xml.gz
    gunzip -f listings.xml.gz
    mythfilldatabase --no-delete --file 1 -1 listings.xml --update
  6. Alter the XMLTV ID values within the MythTV configuration for the channels that you want to have updated by the Nice EPG. This can be done using mythtv-setup or by using mythfilldatabase passing the --manual flag rather than --update. The XMLTV ID values I am using based on the Nice EPG are below.
  7. Analog Channel ID mappings to Nice EPG XMLTV Channel ID
    Channel Analog Channel ID Nice EPG XMLTV ID
    TV ONE 2 1031.dvb.guide
    TV2 4 1032.dvb.guide
    TV3 7 1033.dvb.guide
    C4 9 1034.dvb.guide
    Juice TV 57 1007.dvb.guide
    Prime 59 1037.dvb.guide
  8. Open up KCron or any other Crontab editor of your choice.
  9. Schedule the newly created shell script nice.net.nz.sh to run daily at a suitable time as the mythtv user. Since it doesn’t do any web-site scraping it is much faster than xmlTVNZ so could be run at any time of the day without any problems. Based on the last time the listings.xml.gz file was updated on nice.net.nz (~5:30 AM) it would be good to schedule it sometime after 6 AM.

Getting XBMC MythTV to work with Kubuntu Feisty Fawn (7.04)

Monday, April 30th, 2007

After upgrading to Feisty Fawn (7.04) of Kubuntu I thought I had made all the necessary changes for my XBMC (XBox Media Center) MythTV frontend to talk to the Kubuntu server running the MythTV backend. Part of the Kubuntu upgrade altered the /etc/mysql/my.cnf configuration file for MySQL. This alteration required me to change the bind-address from localhost to the static IP addess of the server.

I thought that this change would be sufficient but it turns out that it wasn’t. The MythTV frontend on my XBox failed to connect to the MySQL database on the MythTV backend for completely non-obvious reasons. If the error output in the MythTV frontend was better I probably would of identified the problem much more quickly. After some hours of looking closely at the MySQL configuration changes and various other network related settings in Kubuntu it looked like it might have something to do with the MySQL password handling.

The old /etc/mysql/my.cnf had a old_passwords = 1 setting in it. The new configuration file did not. In addition, within the newly added configuration import directory /etc/mysql/conf.d there was an old_passwords.cnf file that explicitely set old_passwords = false. This gave me enough clues to see if the MythTV front end for the XBMC was in fact using the old password authentication mechanism (no longer supported by the server with this configuration). I found plenty of references to versions of PHP needing to use the old password authentication mechanism for MySQL and wondered if there was a similar issue with Python (the language used for the MythTV frontend on the XBMC). That information was enough to convince me to try and find out how to configure the server to continue to use the old password mechanism to see if that changed anything.

Based on instructions in the MySQL reference documentation at Client does not support authentication protocol I first tried to get the MySQL daemon mysqld to start with the --old-passwords parameter so it worked like it would have prior to the upgrade. I couldn’t get this to work (the MySQL documentation is a bit sparse on how to set some of the configuration options) so I tried to set the password for the mythtv user using the OLD_PASSWORD() function instead of the PASSWORD() function. By a stroke of luck that actually worked. That’s where I’m leaving it too.

If it aint broke, don’t fix it.

So, at the moment the MySQL configuration is exactly the same way as it was after upgrading to Kubuntu Feisty Fawn (7.04) apart from the bind-address being set to the static IP address of the server. In addition, the MySQL password for the mythtv user has been reset using the OLD_PASSWORD() function.

  1. Login to MySQL as the root user
  2. mysql -u root -p
  3. SET PASSWORD for mythtv = OLD_PASSWORD('mythtv'); - where ‘mythtv’ is the password that is configured in the MythTV settings on the XBox.
  4. Test the settings in MythTV on the XBox
  5. Pat yourself on the back when it works and then go to bed…

This was pretty frustrating to have to deal with. If the error getting spat out of the MythTV frontend on XBMC was better this problem would have been much easier to find with a bit of searching on Google.