Friday, July 06, 2012

MythTV 0.25, HDHomeRun, and a remote on an EEE Box (unfinished...)

Background

I've previously installed Mythbuntu and used it happily, but after upgrading to 0.25 (and Mythbuntu 12.04 LTS), I've had severe glitches when recording most channels. This is most unsatisfactory. So I decided to do a complete reinstall and see if the problem persisted. It did. However, I've documented everything I did, so that when I find out what's wrong, this will hopefully serve as a step-by-step guide for others.

But until then: If you have an EEE Box and an HDHomeRun, I cannot recommend you to install Mythbuntu 12.04. Use an earlier version, which has been working nicely for me.

By the way: I'm sorry that the formatting on this page is a bit messed up. I'm just not able to format blog posts on Blogger decently...

Installation


Create USB disk

Download the 64-bit edition of Mythbuntu. Create a USB disk as described in the official Ubuntu documentation (I have a Mac, so I followed this).


Boot

Put the USB disk in the EEE Box, boot the machine. Hold down F2 during boot to go to the BIOS menu. Go to the Boot tab, select "Hard Disk Drives", press enter. In the list of hard disk drives, you should see both the real hard disk and your USB disk. Re-arrange the list so that the USB disk is first, and your hard disk is second. Save and exit, and your machine should now boot from your USB disk.


Install

Choose "Install Mythbuntu" when the welcome screen appears. You can choose "Download updates while installing", and I guess you need to select "Install this third-party software". Click "Continue".

Since I had a previous Mythbuntu install, I had the chance of installing the new side by side. I chose the "Erase and reinstall" option.

As for disk partitioning, I like to have 20GB for the actual Mythbuntu install, 5GB swap space, and the rest as a separate partition for my recordings (mounted as "/data"). Choose what fits you the best. And remember to select the right "Device for boot loader installation" (the guide had chosen the USB disk, which is obviously wrong).

As for "Installation type", choose "Primary Backend w/Frontend".

For "Additional Services", I chose "VNC Service", "SSH Service", and "MythTV service". I deselected "Samba Service" and left "NFS Service" unselected. Do what you want here.

When asked about "Infrared Remotes", choose "USB & Serial Remote support via LIRC (Linux Infrared Remote Control", and choose "Windows Media Center-Transceivers/Remotes (all)", make sure that "Generate dynamic button mappings" is checked.

As "Graphics Drivers", select "NVIDIA Graphics", and disable TV-Out. That should finish off the installation.

After rebooting, Update Manager wants to update some packages. Let it. And restart your box.

Backend setup

Quit Mythfrontend, start MythTV Backend Setup.

General

Go to "General", and set your "Locale Settings". I've chosen "PAL" as "TV format", "PAL teletext" ad "VBI format", and "europe-west" as "Channel frequency table".

Storage paths

Before you start using MythTV for real, remember to adjust the paths in MythBackend that define where recordings, live-tv, etc. go. It's under "Storage Directories". If, like me, you've mounted most of the EeeBox harddisk under "/data", you probably want values such as "/data/mythtv/recordings", "/data/mythtv/livetv", etc.

You should also create these directories in the file system, and remember to give proper rights to the mythtv user. I've just set all these directories to the mythtv user, the mythtv group, and given all rights possible. Perhaps that's a bit too much, but I don't want to spend time fiddling with this.

Tuner

Create a new "Capture card", with Card type "HDHomeRun DTV tuner box". As "Available devices", choose the one with your serial number and ending in "-0". Create yet another "Capture card", now choose the one with your serial number and ending in "-1".

Create a new "Video source". What you choose here depends heavily on where you are, etc. I have an account at a Danish XMLTV provider which is not officially supported by MythTV, so I choose "No grabber" as "Listings grabber". As name, I have chosen "ontv".


Go to "Input connections" and connect your two HDHomeRun tuners to the new video source: Select one line at a time, and select your video source under "Video source".

Channel scan

First, you need to find out where your channels are situated. Run

hdhomerun_config 12106FA4 scan 0

(where 12106FA4 is your tuner's serial number.) This will show you at which frequences and modulations your channels are.

Go to "Channel Editor", and choose "Channel Scan". Choose "Full Scan (Tuned)" as "Scan type", and enter the various frequencies and modulations and scan for each.

Sound and picture quality


Sound via HDMI or TOSLINK

If you want sound through the HDMI cable, create the file /etc/asound.conf with the following contents:

pcm.!default {
  type hw
  card 0
  device 3
}

If instead you want sound through the optical digital out, specify device 1.

Start "alsamixer" from a terminal and unmute "S/PDIF 1" by clicking M on it.


Picture quality

Turn on VDPAU in the "Setup -> Video -> Playback", otherwise the EeeBox doesn't stand a chance when playing HD content.

Still, playback isn't always perfect, since the refresh rate on your TV doesn't necessarily match the refresh rate of the played material. To fix this, you need to do two things: First, go to "Setup -> Appearance", and on the "Video Mode Settings" page, check "Separate video modes for GUI and TV playback". Just choose 1920x1080 as the GUI and Video output resolution, and choose "Auto" as the rate. Don't change the values in the "Overrides for specific video sizes" section.

Secondly, open nvidia-settings and uncheck the "Force Full GPU Scaling" on one of the pages. Voila! Playback is now perfect! (At least on my setup :-) )

Importing XMLTV


First, set all the XMLTV IDs for your channels: Go to MythWeb, click the "MythTV" link in the upper left, and choose "Settings -> TV -> Channel Info".
Since I get my XMLTV from a specific URL, I have a mythfilldatabase.sh script which is quite simple:


#!/bin/bash


LOGFILE=/home/me/mythfilldatabase.log


source /home/me/.profile


mv /home/me/tvgrabbed.xmltv.1 /var/log/mythtv/tvgrabbed.xmltv.2
mv /home/me/tvgrabbed.xmltv /var/log/mythtv/tvgrabbed.xmltv.1


cd /home/me/
wget --output-document=/home/me/tvgrabbed.xmltv http://ontv.dk/xmltv/SECRET  
/usr/bin/mythfilldatabase --file --sourceid 1 --xmlfile /home/me/tvgrabbed.xmltv > ${LOGFILE} 2>&1

It just wgets the xmltv file, loads it, and stores the last two days of xmltv files. (Of course, replace "me" with your user name and SECRET with your ontv ID if you want to use the above.)



Then set up a Cron job: Run "crontab -e", define a line like:

00 06 * * * /home/me/mythfilldatabase.sh

Various settings

Securing MythWeb

Open "Mythbuntu Control Centre" (start it as root), go to the "Plugins" page, and enable password protection.

Start/end of recordings

It's nice to start recording e.g. 2 minutes before the official starting time, and end recording e.g. 5 minutes after the official ending time. In MythWeb, you can alter the setting "DefaultStartOffset" and "DefaultEndOffset". Both are specified in minutes, so I've set them to 2 and 5, respectively. This implies that the default values of the fields "Start Early" and "End Late" in the recording dialog page will be set to 2 and 5 minutes.

Current status

Well... some channels work fine, and others have glitches, just like some network packets get lost.

The problem is not network-related: I've tried wiring the EEE Box and the HDHomeRun directly to each others (setting "Link-Local Only" in "IPv4 Settings" in the network config GUI). MythTV found the HDHomeRun and could show the channels, but with exactly the same problems as before.

The problem is not related to the EEE Box: I can start hdhomerun_config_gui, scan for channels, and see all channels perfectly with VLC. No glitches. (And I can do the same with other machines on the network, naturally.)

You can see an example here. The first few seconds are not that bad, but then the artifacts start. For more action-packed sequences, the artifacts make the recordings unwatchable.

By the way, my problems look a lot like these, except that my problems don't seem to be network-related.

4 comments:

  1. Ole, I'm not sure if you fixed this issue already -- but if not, I've had similar problems also with HDHomeRun and MythTV 0.25.

    The workaround for me was to install the kernel drivers for HDHomeRun.

    You may want to have a look at http://www.b4net.dk/?p=227

    ReplyDelete
    Replies
    1. Hi Per!

      Thanks for the reply - and sorry about my very delayed response.

      I stopped using MythTV some time ago, and instead wrote my own PVR scheduling software which runs on top of the official command-line tools. You can have a look at it here: https://github.com/olefriis/simplepvr

      It has been working flawlessly for me since the first raw prototype, and it's so nice to have a simple solution that I'm able to extend myself for whatever needs I have.

      I still have MythTV installed on my box, but only to play back the recordings from SimplePVR. That works quite fine. (I'm working on an XBMC plug-in, so MythTV is on its way out for good in the near future.)

      However, thanks a lot for your feedback. I hope people who have stuck with MythTV are able to get it to work with the kernel drivers!

      Delete
  2. Have you guys tried the mythtv plugin?

    ReplyDelete
    Replies
    1. Hi Mike!

      Uhm, the MythTV plug-in for MythTV? :-)

      Or are you talking about a HDHomeRun plug-in for MythTV? MythTV "supports" HDHomeRun out of the box, it just stopped working. I don't know if they've fixed it, but I lost my patience and ditched MythTV altogether.
      /Ole

      Delete