MythTV

From Gentoo Linux Wiki

Jump to: navigation, search

Under Development

This page is currently under development by: Gregfleury

It aims to provide you with: This article is being re-written from scratch based on new howtos and recent Gentoo v2008 release over kernel 2.6.27. You are welcome to refer to the old article for an outdated version of this howto. Many of the steps are missing or no longer apply.

Concerns or Compliments? Please use the discussion page.

Warning: BIG FAT WARNING -- UPGRADING TO VERSION 0.22 MIGHT CORRUPT YOUR DATABASE, REQUIRING YOU TO RECONFIGURE! Follow these ungodly lengthy instructions for the few commands needed for upgrading your database -- after upgrading MythTV to version 0.22. (I only had warnings within personal*.MYI files preventing auto upgrade of the mythconverg database. And after following the instructions, everything works without reconfiguring. Auto upgrade of the databse is performed by running mythtv-setup as root while the backend is stopped.)

This document explains how to configure MythTV, a free Linux application that turns a computer with the necessary hardware into a network streaming digital video recorder, a digital multimedia home entertainment system, or Home Theater Personal Computer. It can be considered as a free and open source alternative to TiVo or Windows Media Center. -- Wikipedia:MythTV

MythTV consists of two parts:

  1. A Back-End, which drives the video capture device to record shows and manage various other addons
  2. A Front-End, which is mainly a remote-control and viewer

Both parts can run on a single computer. However, the intent is for you to run a distributed system, with the back-end sitting on a server somewhere, and the front-end being your XBox, another PC, or even a Windows machine.

Note: Depending on the hardware you have, setting up a working Myth installation can be tricky and will probably take you several hours of hacking. This article is meant to be a a recipe, so make sure you have Google handy.

Contents

[edit] MythTV Versions

This guide applies to the following versions of the software:

OS Release Gentoo-2008.0
MythTV 0.21
IVTV-Utils 1.3.0-r1
MySQL 5.0.70-r1
Samba 3.0.33
ntp 4.2.4_p5

[edit] Prerequisites

Hardware:

  • Configured network adapter (100Mbit recommended)
  • A video capture device (Supported Cards)
  • A sound card (not required to record)
  • A supported IR capture device and a remote control of your choice (front-end only)
  • Decent video adapter that supports OpenGL is recommended

Software:

[edit] Kernel config

As with any Gentoo install you will need to spend some time making sure the kernel is properly configured for your system. Obviously this is going to be largely specific to your hardware and choice of set up, however there are a few kernel config options worth pointing out:

  • If you want to watch DVDs you will need UDF file system support:

UDF_FS [=y] | -> File systems -> CD-ROM/DVD Filesystems

  • If you are installing IVTV-Utilities when using a x86_64-bit kernel, you will find that even though you've correctly selected all options as modules, it still gives you the "CONFIG_KMOD must be set" error. Basically, CONFIG_KMOD is responsible for automatic loading of modules, and it only applies to 32-bit kernels it seems (2.6.29.x series).

The easiest way to bypass this whole thing is to simply edit the kernel by hand and insert the line "CONFIG_KMOD=y", then emerge/build ivtv-utils, then go back and yank the line out.

[edit] Use flags

Before you do any more compiling it is a good thing to get your use flags set up correctly, this prevents you from having to re-compile things later on

The following command will display all the use flags you have in place, the total of your profile, the /etc/portage/package.use files(s), and your /etc/make.conf:

emerge --info

For example, here is a working example set of use flags for a MythTV front and back-end on Gentoo 2008:

USE="3dnow 3dnowext X a52 aac acl acpi alsa amd64 apache2 avahi berkdb bindist 
bluetooth branding bzip2 cairo cdb cddb cdparanoia cdr cli cracklib 
crypt css cups daap dbus dri dts dvb dvd dvdr dvdread eds 
emboss encode esd evo exif fam ffmpeg firefox flac fortran gdbm gif gpm 
gstreamer gtk hal iconv ipv6 isdnlog java javascript joystick jpegldap 
libnotify lirc latin1 lm_sensors mad mdnsresponder-compat midi mikmod mmx 
mmxext mp3 mpeg mudflap multilib mysql ncurses nls nptl nptlonly 
nsplugin ogg opengl openmp oss pam pcre pdf perl png posix ppds pppd 
python qt3 qt3support qt4 quicktime readline reflection rss samba sdl 
server session spell spl sqlite sse sse2 sse3 ssl startup-notification 
svg sysfs tcpd tiff transcode truetype type1 unicode usb v4l vcd vorbis 
wifi wma xcomposite xine xml xorg xv xvid xvmc zlib"

Set your profile to the Gentoo 2008 'Desktop' profile using eselect (emerge eselect if you don't have it installed):

eselect profile list
eselect profile set *

These are the extra flags you would need in addition to the 'Desktop' profile to achieve the above:

Use Flags: 3dnow 3dnowext a52 aac apache2 avahi bindist cdb cddb cdparanoia css daap dts dvb exif ffmpeg flac -gnome java javascript joystick -kde lirc latin1 lm_sensors mdnsresponder-compat mmxext mysql nsplugin oss posix rss samba server sqlite sse3 transcode type1 v4l vcd wifi wma xcomposite xine xvid xvmc (?)

You may wish to run this command after changing your profile and adding/removing useflags

emerge --sync
emerge -uDNav world

This will re-build myth and your entire system with lots of useful features. It's probably worth taking this time to highlight a few individually:

  • qt3 MythTV 0.21 requires you to use Qt 3. It is not compatible with Qt 4 so you need to install version 3 as well as 4 if you have that installed.

Here are some other flags useful to MythTV that are not included above:

  • ivtv Make sure you add this use flag if you plan on using the TV output on a PVR-350 card.
  • ieee1394 If you will be using any Firewire devices.
  • dga To support Direct Graphics Address.
  • x264 To support the x264 free software library for encoding H.264/MPEG-4 AVC video streams.

[edit] MySQL

Note: Note that you must use the correct encoding. For more information on why you need to use the latin1 encoding, and how to do so, see the mythtv wiki.
So add latin1 to your USE variable in /etc/make.conf before emerging the mysql package.

If you haven't already, emerge MySQL and then run mysql_install_db (via emerge --config), which will create a default database for you:

emerge -a dev-db/mysql
emerge --config dev-db/mysql

Follow the instructions on setting your MySQL root password and then start it:

/etc/init.d/mysql start

Now run the following command:

mysql -u root -p

Once you provide the password, you should see a mysql prompt:

mysql> 

Now issue the following to see a list of configured databases:

mysql> show databases;

If you see this output, MySQL is running and ready:

+--------------------+
| Database           |
+--------------------+
| information_schema |
| test               |
+--------------------+
2 rows in set (0.00 sec)

Finally, tell MySQL to start on boot:

rc-update add mysql default

For more info check the MySQL Startup Guide

[edit] IVTV

Note: As of kernel 2.6.26 ivtv driver has been merged into the kernel code itself. The package will install the firmware and some command line utilities.

The only thing you need to install is ivtv-utils. Please check the above link for instructions. Once installed, there is an easy test you can run to ensure that both IVTV and your video capture device is operational:


This changes the channel to channel #22 for us-cable:

/usr/local/bin/ivtv-tune -c22

You should see the following output if everything worked:

/dev/video0: 169.250 MHz  (Signal Detected)

Of course your MHz may differ, depending on your cable provider.


There is one more test you can perform to see if your tuner actually works:

cat /dev/video0 > /tmp/channel22.mpeg

Once you issue the command, the prompt will just sit there while the device captures the signal directly to an mpeg file. After 30s or so, break the operation (Ctrl-C) and copy your file to a location where you can play it. It should your cable channel 22 with sound and video.

[edit] X.Org

MythTV backend requires X and Qt 3 for myth-setup to run. Outside of importing an existing setup from another system directly, there is currently no way around not having X.Org installed to properly configure and test Myth at this time. The reason for this is a common question of whether X is actually required.

This article will not go into details about how to configure X with your favorite video card driver. You must do this before attempting to configure Myth. You can test your setup by invoking X.Org and making sure your video driver works properly. You should consider installing OpenGL-version to speed things up! (this is not a hard requirement).

Note: If you need to configure X.Org, please check our wiki article

[edit] Installing MythTV using MythTV Source for VDPAU support

On the MythTV roadmap official support for VDPAU will be added in the 0.22 release of MythTV. This is still quite a way out. However Jean Yves Avenard has backported the VDPAU code from the 0.22 release to 0.21 release. The only way to get this to work in a Gentoo environment is to download the sources apply the patches and compile the code yourself. The info on the following page might help you.
MythTV and VPAU

[edit] Installing MythTV via gentoo Portage package

Adding the following to your package.keywords file will enable you to have the most recent version of MythTV:

File: /etc/portage/package.keywords
x11-themes/mythtv-themes-extra
x11-themes/mythtv-themes
media-tv/mythtv
media-plugins/mythvideo
media-plugins/mythnews
media-plugins/mythmusic
media-plugins/mythgallery
media-plugins/mythbrowser
media-plugins/mythgame
media-plugins/mytharchive
www-apps/mythweb

Then run this command to install, you can add or remove various parts of MythTV if you wish:

emerge -av media-tv/mythtv media-plugins/mythvideo media-plugins/mythmusic
Note: The emerge process created a mythtv user for you.

Once complete, you need to set up inject the main database dump into MySQL:

mysql -u root -p < /usr/share/mythtv/database/mc.sql

Test to make sure the database made it ok (the password is mythtv):

mysql -u mythtv -p
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mythconverg        |
| test               |
+--------------------+
3 rows in set (0.00 sec)

Note the presence of the mythconverg database.

In case you wish to run your backend as mythtv, you need to add that user to the video group:

gpasswd -a mythtv video

[edit] Installing XMLTV (Optional)

Now that the basics are complete and myth compiled and installed correctly, you are ready to install XMLTV. This is an external Perl-based set of packages that allow you to grab TV listings from an external source and inject them into the MythTV channel database. In US and Canada the TV listings are no longer free (as they used to be with Zap2It), so before you install this, be sure to spend the $20.00 and purchase a Schedules Direct annual subscription which works wonderfully with MythTV.

emerge -av xmltv

Again, there are 70 or so packages that will be installed. Albeit small, these still take some time.

Once XMLTV is installed, you are ready to fire up X and begin the basic configuration process.

[edit] Configuring MythTV Backend

Invoke X.Org as you (not root) and open a terminal window.

Issue the following command and follow the on-screen instructions:

mythtv-setup

mythtv-setup will often crash on multiprocessor systems, especially when channel scanning. To make it run on one CPU use:

taskset -c 0 mythtv-setup
Main screen

This is the first screen you will see when you start the setup. You will need to go through each of the five options and carefully inspect each screen. At the risk of running a bit off topic, we'll take you through some of the setup options.

[edit] General

This section deals with the general setup of MythTV. There are some settings you must correct in order to get the system to work.

Server setup screen
  • IP address: Set the field to your external IP address.
  • You can leave the ports alone. It is best not to change that.
  • Master Server IP address: Set to the same one as above.

If you have DHCP set on your MythTV backend, this may cause issues for you. You are best to affix a static IP and key it in directly here

Click next when complete.

TV files directory

This screen sets the directory where your recorded shows are stored. Make sure you select a place with at least 5 gigabytes of hard disk space available. Also, be sure to run the following command to set the group ownership to mythtv:

su chgrp mythtv /pub/tv && su chmod g+rw /pub/tv
Backend format setup
  • TV format: If you are in North America you want NTSC.
  • VBI format: None if you are not doing digital.
  • Channel frequency table: Again, if you are in North America, and have your tuner hooked up to a us-cable provider, you want us-cable.
EIT Scanner Options

You can leave all these as default.

Shutdown and Wakeup Options

You can leave all these as default.

[edit] EDID Modelines (Data from your Monitor/TV)

You will most likely need a valid Modeline for your HDTV.

Most modern monitors/TVs can be probed for EDID data concerning their capabilities and requirements. EDID stands for "Extended Display Identification Data".

EDID data are recorded in PROM (programmable read-only memory) or EEPROM (electrically erasable PROM) within the monitor/TV itself. The modelines recorded in the EDID data, are those recommended by the manufacturer (and as such, usually give great results (although, occasionally, the manufacturer supplied data is incorrect)).

EDID modelines are recorded for many different monitor/TV screen resolutions.

EDID information includes manufacturer name, product type, phosphor or filter type, timings supported by the display, display size, luminance data and (for digital displays only) pixel mapping data.

On Linux the EDID modelines can be found by running the command:

startx -- -logverbose 6

from the console. The EDID information is written to the file /var/log/Xorg.0.log (or /var/log/XFree86.0.log).

As an example: Some of the EDID data for a Philips 170S 17" TFT.

EDID Version                 : 1.3
Manufacturer                 : PHL
Monitor Name                 : Philips 170S
Product ID                   : 2078
32-bit Serial Number         : 693129
Serial Number String         :  CF  693129
Manufacture Date             : 2003, week 32
DPMS Capabilities            : Standby Suspend Active Off
Prefer first detailed timing : Yes
Supports GTF                 : No
Maximum Image Size           : 340mm x 270mm
Valid HSync Range            : 30.0 kHz - 82.0 kHz
Valid VRefresh Range         : 56 Hz - 76 Hz
EDID maximum pixel clock     : 140.0 MHz
Validating Mode "1280x1024":
  1280 x 1024 @ 60 Hz
  Mode Source: EDID
    Pixel Clock      : 108.00 MHz
    HRes, HSyncStart : 1280, 1328
    HSyncEnd, HTotal : 1440, 1688
    VRes, VSyncStart : 1024, 1025
    VSyncEnd, VTotal : 1028, 1066
    H/V Polarity     : +/+
  Mode is valid.

Validating Mode "1280x960":
  1280 x 960 @ 60 Hz
  Mode Source: EDID
    Pixel Clock      : 108.00 MHz
    HRes, HSyncStart : 1280, 1376
    HSyncEnd, HTotal : 1488, 1800
    VRes, VSyncStart :  960,  961
    VSyncEnd, VTotal :  964, 1000
    H/V Polarity     : +/+
  Mode is valid.

Validating Mode "1152x864":
  1152 x 864 @ 70 Hz
  Mode Source: EDID
    Pixel Clock      : 96.76 MHz
    HRes, HSyncStart : 1152, 1224
    HSyncEnd, HTotal : 1344, 1536
    VRes, VSyncStart :  864,  865
    VSyncEnd, VTotal :  868,  900
    H/V Polarity     : -/+
  Mode is valid.

and many more such. 

The modelines obtained from the three results above, are:

ModeLine "1280x1024_60.00" 108.0  1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync
ModeLine "1280x960_60.00"  108.0  1280 1376 1488 1800 960  961  964  1000 +hsync +vsync
ModeLine "1152x864_70.00"   96.76 1152 1224 1344 1536 864  865  868  900  -hsync +vsync

The term in the quotes, e.g., 1280x1024_60.00, is just a user defined name for the mode.

For more see: A list of Common Video Mode-Lines.

[edit] Capture Cards

Fix me: Explain how to use capture cards

[edit] External links

Personal tools