Myth BOX
The home of guides for Myth TV, IPTables, and other linux based phenomena.
 
HD version
Preamble
Home
News
Spec
General guides
Partitioning
Installation
Firewall
Channel setup
Home automation
Product overview
Other
Useful links
SD version
Preamble
Functionality
Hardware
Software
Screenshots
Gallery
General guides
DVB Card
Myth TV
Broadband modem
Wireless network
Firewall
Network shares
Network IDS
Extra security
Streaming
Gensplash
EPIA specific guides
TV-Out cables
Audio/USB cables
Backplate
Wireless network
EPIA Kernel
Openchrome drivers
Surround sound
VPN
Online store
Prebuilt mythbox
Other
Useful links

Myth TV

Basic setup

  1. First of all you will need to download the ebuild file that will allow you to build Myth TV 0.20 under Xorg 6.9. These guides are not based on Xorg 7 and instead assume that you will eventually be using the tried and tested Unichrome XvMC based drivers available for Xorg 6.9. The ebuild file can be found here.
  2. Put the ebuild in /usr/portage/media-tv/mythtv/.
  3. You need to have allowed masked packages in your /etc/packages.unmask for media-tv/mythtv and media-tv/linuxtv-dvb.
  4. Check that you have the following USE flags in /etc/make.conf (you will need them later): transcode aac libdvdread fftw.
  5. Execute: emerge mythtv, followed by: emerge mysql. Stright after, run: mysql_install_db.
  6. To make mysql and mythbackend start on boot, run: rc-update add mysql default, and rc-update add mythbackend default.
  7. Change the mysql root password using: mysqladmin -u root password <newpass>, and mysqladmin -u root -h <hostname> password <newpass>.
  8. To start mysql now, do: /etc/init.d/mysql start.
  9. Download the channel icons from here and extract them into /usr/share/mythtv/icons/tv/.
  10. Now to setup mythtv, first execute mysql -u root -p < /usr/share/mythtv/database/mc.sql. Then run mythtv-setup and set up your card and input connections. Most of this is self-explanatory but more information can be found at http://www.ethics-gradient.net/myth/mythdvb2.html and of course at www.mythtv.org. Use the channel editor menu to automatically search for channels (you will need to enter the details for BBC ONE from your channels.conf file). Use the channel editor to add the icon path for each channel.
  11. Reboot, then check that you have a working myth backend by doing a netstat -a. Look in the list and ensure that port 6543 is open. If not, check out the troubleshooting below.
  12. Create a mythtv user, and create a symbolic link to your dvd drive. Also, emerge ntp to keep your clock up-to-date. Info can be found at http://wopr.yi.org/mythtv.html.
  13. Ensure that the /mnt/store directory is readable and writable by the myth user as well as root. Then login as the mythtv user, and type mythfrontend!
  14. If you selected to keep the mythbackend open all the time (not just on demand) then the programme guide should get propagated with data whenever you don't tune in or record a channel. :)

Troubleshooting:
  • I've installed mysql and mythtv but when I do netstat -a, I don't see port 6543 in the list.
    This is most probably a problem with your mysql connection. This confused me for weeks. Dropping the mythconverg database and re-emerging mysql and following the setup procedure again for mysql. You will have to put your channel info in again. Ensure that after you inport the myth database, that the mythtv user is in there. After rebooting, or restarting the backend, you should find that the port appears.

The remote control

  1. The first step to getting your remote control working is to emerge lirc with the event driver using LIRC_DEVICES="devinput" emerge lirc.
  2. Now the guide assumes that you have lirc in your USE flag in your /etc/make.conf. If you don't (and didn't when you compiled MythTV) then you should recompile with it in by using emerge mythtv.
  3. Ensure that your kernel has the modules listed below compiled in:
    Device drivers -->
        Input device support -->
            Event interface -->
    Loadable module support -->
        Module unloading
    
  4. Rebuild your kernel and reboot so that you are running your new kernel.
  5. Do cat /proc/bus/input/devices and note down what event number the TV card is on. This should be listed as one of the handlers for the device, for example H: Handlers=kbd event2.
  6. Now check that you can get output from your remote by doing cat /dev/input/eventX where eventX is replaced with your event number. Press some buttons on your remote and you should see some garbage on you screen.
  7. Now edit /etc/conf.d/lircd so that it takes on the form LIRCD_OPTS="-d /dev/input/eventX".
  8. Now you need a lirc configuration file for it to operate. Copy this file to /etc/lircd.conf.
  9. Next you need a lircrc file to specify what buttons myth and xine map to what operations. Get this one, and copy it to /home/mythtv/.mythtv/lircrc. Then link it for xine using: ln -s /home/mythtv/.mythtv/lircrc /home/mythtv/.lircrc.
  10. Now start lirc using /etc/init.d/lircd start. Ensure that lirc starts on boot by doing the following command: rc-update add lircd default.

Troubleshooting:
  • When I cat /proc/bus/input/devices, no event number is listed!
    You haven't loaded the event interface module, haven't compiled it into the kernel, or aren't running the kernel that has the module compiled in.
  • When I cat /dev/input/eventX, I see nothing on the screen!
    First things first, check the batteries and that the cable is attached properly. I had the same thing for one and a half years, and it turned out my IR sensor was dead. Borrow another sensor and try that.
  • I get strange log messages and no response from the remote control!
    Do you use a USB mouse and find it stops working, with an error message like "uhci: PCI host halted: very bad" in the logs? If so, it could be this causing the remote to stop working. I had the same problem, and the solution was to change my BIOS setting to increase the PCI timing delays (whatever they do).

Improving picture quality

  1. Two of the best ways of improving the picture quality is by ensuring that the picture is being deinterlaced (to remove nasty lines), and that motion compensation is being performed (to give a smoother picture overall).
  2. To make MythTV perform deinterlacing, run mythfrontend and go into Setup and Playback. Check the box for Deinterlaced playback.
  3. I would also check the boxes for Jitter reduction and Extra Audio Buffering, and if you don't mind suffering unsynch'ed A/V for the first few seconds, select Experimental A/V Sync to keep the A/V sychronised throughout playback or viewing.
  4. To enable motion compensation you must first emerge nvidia drivers in the case of GeForce style cards. Do an emerge search nvidia for details.
  5. Ensure that opengl is in your USE flags.
  6. Edit /etc/X11/XF86Config and the device section change the driver to nvidia. Also in the modules section, ensure that you are loading the glx module, and have commented out the dri module.
  7. New switch to the NVidia® drivers using opengl-update nvidia.
  8. Add nvidia to your USE flags.
  9. Now re-emerge mythtv and it will pick up on the installed nvidia drivers and install support for XvMC (Xvideo motion compensation).
  10. Appropriate drivers for the EPIA boards are given later.

MythArchive and Myth TV Burn

As of Myth TV 0.20, the MythArchive plugin was added to allow you to burn your recordings to DVD. Unfortunately it is still in its infancy, and as such MythWeb doesn't support it, and commercial cutting is based solely on the cut list and does not accept any aspect ratio parameters. Therefore, I suggest that the MythArchive plugin be used with caution until it becomes more established. The modified mythburn package is available on this site if you want a tried and tested way to burn to DVD albeit slightly less user-friendly. This is also your only option if you wish to cut out video of a specific aspect ratio, e.g. where it is known that the programme has an aspect ratio of 4:3 but the commercials have an aspect ratio of 16:9.

The MythArchive plugin will require patching in order that it will work correctly. Several issues are currently present, the first being that audio streams are ordered by PID. This in itself is not an issue. However, because mythtranscode reorders these PIDs and the first audio PID is almost always ordered as the hard of hearing audio track transmitted in the UK, it often results in a DVD with silent or unwanted audio tracks. The second issue is with a libavformat library function used to find a stream's audio and video tracks. In an effort to reduce the channel changing time, analysis of the stream will stop once an audio track has been found, which may or may not be the one you require. By making MythArchive use a modified version of this function, all tracks are found 100% of the time. The patch to be applied to the mythtv-0.20 tarball can be found here, and the patch for the mythplugins-0.20 tarball can be found here. Respective bug reports and Trac tickets on the mythtv.org website can be found here and here. An issue that is currently unpatched however, is the A/V synchronisation problems that occur when mythtranscode is given a stream containing errors.

The modified mythburn package allows the creation of DVDs that contain animated image based menus, chapter menus, background music, and programme descriptions extracted from the myth database. This modified version has an added option to enable you to cut out commercials based on aspect ratio. This makes commercial cutting of older programmes effortless. :) Here's what you need to do:
  1. At this point, I will assume that you have already setup mythweb (this is relatively straightforward and well documented).
  2. Download the mythburn tarball, found here, into /usr/share/mythtv/.
  3. Go into /usr/share/mythtv and do tar -xzvf mythburn.tar.gz.
  4. Check that are the necessary packages are installed using emerge -p sun-jdk mjpegtools dvdauthor imagemagick transcode perl avidemux lve. If any aren't present, emerge them.
  5. Refer to gentoo's java guide on how to setup your java environment so that your java works properly.
  6. Go into the projectx subdirectory and build the java packages using ./build.sh.
  7. Go back into /usr/share/mythtv/mythburn and run the install.sh script. You should enter the relevant directories as prompted by the script. The command needed to run ProjectX will be: /opt/sun-jdk-<your_java_version>/bin/java -jar /usr/share/mythtv/mythburn/projectx/ProjectX.jar.
  8. Now from the mythburn folder, you are able to run a command of the following format:
    nice ./mythtvburn.sh <tv_format> <background_image>
    <background_music> <make_iso_image> <burn_to_dvdr>
    <delete_video_ts> <highlight_image> <animated_menus>
    <sub_menus> <recode_ntsc> <auto_cut> <burn_file_1>
    <nocut|cut> <burn_file_2> <nocut|cut> > temp/mythburn.log
    2>&1 &
    
    where burn_file_X is a recording's filename.
  9. The recording's filenames can be determined by using MythWeb. Find the recording you want, view the source URL of the assoicated image, and use the filename there (minus the image extension).
  10. To get you started, here's a simple example to remove all video that doesn't have an aspect ratio of 4:3:
    nice ./mythtvburn.sh pal plasma-tomato.png silence.mp2 yes no no barbwire.png
    yes no no 4to3 <burn_file_1> nocut <burn_file_2> nocut > temp/mythburn.log
    2>&1 &
    
    And here is an example where the marked cutpoints are used to identify video segments to remove:
    nice ./mythtvburn.sh pal plasma-tomato.png silence.mp2 yes no no barbwire.png
    yes no no none <burn_file_1> cut <burn_file_2> cut > temp/mythburn.log
    2>&1 &
    
  11. The DVD will have been created in /usr/share/mythtv/mythburn/DVD/ along with the DVD ISO image /usr/share/mythtv/mythburn/temp/mythburndvd.iso.

Troubleshooting:
  • DVDAuthor complains about chapter points and then quits.
    Don't use chapter points if you have these problems. I have the same issue, but if you don't enable chapter points, the recording will work just fine.
  • I get an error saying xxxx.mpg does not exist!
    Ensure that you only include the filename and not the full path in place of each burn_file entry - the full path will get added after.