Installing MythTV on Ubuntu Linux
From Section6wiki
Contents |
Installing MythTV on Ubuntu Linux
MythTV is a GPL licensed suite of programs that allow you to build a Personal Video Recorder (PVR) system on your own using Open Source software and operating systems. Much like commercial systems such as Tivo, MythTV allows one to pause live TV, schedule recordings, and use a variety of media such as music CDs, DVDs, and digital photos as well. MythTV in its current incarnation runs on most GNU/Linux distributions. The distribution(s) of choice here at Section6 happen to be:
For the following article, we will use Ubuntu Linux 6.06 (Dapper Drake) as the distribution of choice; the reason being that Ubuntu is easy to work with in terms of package management, and it uses fairly current and stable packages.
Requirements
A computer with a minimum of a 1.8 ghz processor (2.8 recommended), 512MB RAM (1GB recommended), a working soundcard, a working ethernet interface, 80GB harddrive (The larger the harddrive, the better), a working DVD drive (DVD/RW recommended), NVidia Geforce4 or higher (with S-video out capabilities), and a Hauppauge WinTV GO capture card (PVR150 or higher recommended).
We will also need a single S-video cable to run into a television.. and a stereo mini-jack to RCA audio cable to run out of the soundcard into a television or stereo receiver/amplifier. (Note: if you are planning on using optical audio out for 5.1 or above, please consult the Alsa Documentation Wiki for your soundcard information and configuration.
Another thing covered in this document that you till need is the Hauppauge remote control that comes with the WinTV Go capture card. If you wish to use another type of remote control, consult the documentation for LIRC at the following URL:
The final thing we will need is a valid Zap2It account. the Zap2It service allows us to download and populate channel guide information for the area we live in. Accounts are free and require registration at the following URL:
Installing Ubuntu
This is a pretty straight-forward task. For our document here, again we are using Ubuntu Linux 6.06 (Dapper Drake). To install this distribution, simply download the latest Ubuntu ISO file from the Ubuntu download Site, burn it off to CD using your favorite CD burning program, insert the CD in your proposed MythTV computer, boot the computer from CD, once booted click on the setup/install icon, and follow the self-explanatory installation instructions. When the install completes, you will have a freshly installed Ubuntu Linux system.
Configuring APT sources
Ubuntu (and other Debian based distributions) use a packaging system called APT. This packaging system keeps track of installed applications called DEB files. These files can be installed from CD, or even from remote internet sites. The magic of APT is that if a package requires another package as a dependency, APT will automatically install that dependency for us.
We need to configure the source list to tell APT where to install packages from. To accomplish this we need to open a shell (terminal) and change to the /etc/apt/ directory and edit the sources.list file to make it look like the following example:
## Add comments (##) in front of any line to remove it from being checked. ## Use the following sources.list at your own risk. deb http://archive.ubuntu.com/ubuntu dapper main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu dapper main restricted universe multiverse ## MAJOR BUG FIX UPDATES produced after the final release deb http://archive.ubuntu.com/ubuntu dapper-updates main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu dapper-updates main restricted universe multiverse ## UBUNTU SECURITY UPDATES deb http://security.ubuntu.com/ubuntu dapper-security main restricted universe multiverse deb-src http://security.ubuntu.com/ubuntu dapper-security main restricted universe multiverse ## BACKPORTS REPOSITORY (Unsupported. May contain illegal packages. Use at own risk.) deb http://archive.ubuntu.com/ubuntu dapper-backports main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu dapper-backports main restricted universe multiverse ## PLF REPOSITORY (Unsupported. May contain illegal packages. Use at own risk.) deb http://packages.freecontrib.org/plf dapper free non-free deb-src http://packages.freecontrib.org/plf dapper free non-free ## CANONICAL COMMERCIAL REPOSITORY (Hosted on Canonical servers, not Ubuntu ## servers. RealPlayer10, Opera and more to come.) deb http://archive.canonical.com/ubuntu dapper-commercial main
Note that the source servers listed are for Dapper only. If you are using a distribution other than Dapper (Such as Breezy Badger), you will need to change your sources.list file to reflect your particular distribution. Consult your documentation for the correct apt source list.
Once the sources.list file has been edited and saved, we need to update APT so that we can grab the latest package information.
user@host# sudo apt-get update
Once the update has taken place we can upgrade all our packages to make sure we are running the latest stable editions:
user@host# sudo apt-get upgrade
This might take some time so be prepared to wait. Take a coffee break or something. After the upgrade completes, be sure and reboot the system so that we are now using the updates that we just installed.
MythTV pre-installation
At this point we need to install some packages in order to get our system ready to install MythTV. There is a lot of prep work to do here, so patience is a must. Once we get past this hump we can move forward in getting MythTV configured and installed.
user@host# sudo apt-get install build-essential dialog gcc-3.4 ssh module-assistant user@host# sudo apt-get install libapache2-mod-auth-mysql dvdauthor mplayer user@host# sudo apt-get install nvidia-glx-legacy nvidia-kernel-common nvidia-settings user@host# sudo apt-get install apache2 mysql-server-4.1 php4-mysql
You will be prompted on a few of these packages with questions. Unless you specifically want to change any information, the defaults work for most everything.
Afterwards, we now need to download kernel source and headers for our distribution. Depending on the updates we just installed will determine what kernel source and headers we need.
user@host# uname -a Linux host 2.6.15-26-386 #1 PREEMPT Mon Jul 17 19:52:53 UTC 2006 i686 GNU/Linux
In the previous example we have kernel 2.6.15. So we need to download the corresponding kernel source and headers:
user@host# sudo apt-get install linux-source-2.6.15 user@host# sudo apt-get install user@host# sudo apt-get install libncurses-dev kernel-package libqt3-dev
We then need to extract the linux kernel source and make symbolic link for it:
user@host# cd /usr/src user@host# tar -xjf linux-source-2.6.15.tar.bz2 user@host# ln -s linux-source-2.6.15 linux
We now need to prepare the kernel for the additions we are going to make to it:
user@host# cd /usr/src/linux user@host# sudo make oldconfig user@host# sudo make include/linux/version.h user@host# sudo make modules
Compiling the kernel modules will take the most amount of time. Again, sit back and relaxe.. order a pizza.. watch the game or something.
After we are done, we need to install two extra packages that will allow us to play DVDs and Windows based video files. We need to temporarily add a source to our /etc/apt/sources.list file in order to install these packages:
deb http://packages.freecontrib.org/ubuntu/plf/ dapper free non-free
After we have added this entry into our sources list, we need to update APT again.
user@host# sudo apt-get update
After we update we need to install two packages:
user@host# sudo apt-get install libdvdcss2 w32codecs
After we have installed these packages, be sure and comment out the apt source line, so that we do not accidentally updgrade any packages in the future. To comment out a line so that we do not use the source, simply put a "#" sign in front of the line:
#deb http://packages.freecontrib.org/ubuntu/plf/ dapper free non-free
Then we can update APT again to use the original sources:
user@host# sudo apt-get update
Now let us move on to configuring the database.
Configuring MySQL
The MySQL database will house the guide data and various other backend database information that MythTV will require. Now that MySQL is installed, there are just a couple of steps we need in order to prepare the database for useage:
user@host# sudo mysqladmin create mythconverg
Once the database has been created, we will grant permissions for the MythTV database account to use this database:
user@host# sudo mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 54 to server version: 4.1.15-Debian_1ubuntu5-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
This indicates that we are now in the MySQL command environment using the command line MySQL client that was installed earlier.
mysql> grant all privileges on mythconverg.* to 'mythtv'@'localhost' identified by 'password';
This command passed to the MySQL server will grant access to a database user called "mythtv" with a password of "password". Of course you can make the useraccount and password anything you want, but be sure and remember this information later when we go to configure MythTV to use this database account
After you create the account, simply type the following command to exit the MySQL command environment and return to your shell:
mysql> exit
Building LIRC
LIRC is a set of kernel modules and binaries that allow us to use a remote controle with our Linux System. To use our Hauppauge remote we should install LIRC. We have chosen to compile and install from source code because the latest LIRC packages in Ubuntu do not compile and work correctly. At the time of this article, the latest version of LIRC is 0.8.0.
user@host# cd /usr/src user@host# sudo touch /usr/src/linux/Rules.make user@host# wget http://superb-west.dl.sourceforge.net/sourceforge/lirc/lirc-0.8.0.tar.bz2
Once this has been downloaded, we need to extract it:
user@host# tar -xjf lirc-0.8.0.tar.bz2
Then we need to change to the newly extracted lirc directory so that we can configure the modules and binaries that we are going to install:
user@host# cd /usr/src/lirc-0.8.0 user@host# ./setup.sh
This setup dialog will prompt us for a few options before configuring the source code for us. the first option is the driver we wish to configure. In this case we are using the Hauppauge remote control so we would select:
1 - Driver configuration
5 - TV card
G - Hauppauge TV card (new I2C layer required)
Select OK to go back to the Main Menu and choose:
3 - Save configuration and run configure
Then we need to compile the configuration and install it:
user@host# cd /usr/src/lirc-0.8.0 user@host# sudo make user@host# sudo make install
After it is installed we now need to load the kernel module:
user@host# sudo modprobe lirc_i2c
We can verify that it is loaded by checking the list of loaded modules:
user@host# sudo lsmod |grep lirc_i2c* lirc_i2c 7940 0 lirc_dev 11364 1 lirc_i2c i2c_core 19728 6 cx88xx,bttv,i2c_algo_bit,tveeprom,lirc_i2c,i2c_acpi_ec
We also need to make sure the correct devices in /dev were created:
user@host# ls -al /dev/lirc* crw-rw---- 1 root root 61, 0 2006-07-25 18:05 /dev/lirc0 srw-rw-rw- 1 root root 0 2006-07-26 12:21 /dev/lircd
Now that we know the correct modules are loaded and the devices are present, we need to add an alias line to our /etc/modprobe.d/aliases file to load the lirc_i2c module correctly. Add the following statement to the bottom of the /etc/modprobe.d/aliases file:
alias char-major-61 lirc_i2c
We then need to make sure it loads everytime the system boots. To do this we simply edit the /etc/modules file and add the name of the module to the bottom of the file:
lirc_i2c
We then run a few commands to make sure the module list is updated:
user@host# sudo update-modules user@host# sudo depmod -ae
We now need to create a startup script for the lircd service to start everytime the system boots. We need to create and edit a file called /etc/init.d/lircd and populate it with the following:
#! /bin/sh
#
#
DEVICE="--device=/dev/lirc0"
DRIVER=""
ARGS=$DEVICE $DRIVER
load_modules ()
{
local MODULES_MISSING=false
for mod in $*
do
modprobe -k $mod 2> /dev/null || MODULES_MISSING=true
done
if $MODULES_MISSING; then
echo "#####################################################"
echo "## I couldn't load the required kernel modules ##"
echo "## You should install lirc-modules-source to build ##"
echo "## kernel support for your hardware. ##"
echo "#####################################################"
echo "## If this message is not appropriate you may set ##"
echo "## LOAD_MODULES=false in /etc/lirc/hardware.conf ##"
echo "#####################################################"
START_LIRCMD=false
START_LIRCD=false
fi
}
test -f /usr/local/sbin/lircd || exit 0
test -f /usr/local/sbin/lircmd || exit 0
#test -f /etc/lirc/lircd.conf || exit 0
#test -f /etc/lirc/lircmd.conf || exit 0
START_LIRCMD=false
START_LIRCD=true
if [ ! -f /etc/lirc/lircd.conf ] \
|| grep -q "^#UNCONFIGURED" /etc/lirc/lircd.conf;then
if [ "$1" = "start" ]; then
echo "############################################"
echo "## LIRC IS NOT CONFIGURED ##"
echo "## ##"
echo "## read /usr/share/doc/lirc/README.Debian ##"
echo "############################################"
fi
START_LIRCD=false
START_LIRCMD=false
fi
if [ ! -f /etc/lirc/lircmd.conf ] \
|| grep -q "^#UNCONFIGURED" /etc/lirc/lircmd.conf;then
START_LIRCMD=false
fi
case "$1" in
start)
if [ "$LOAD_MODULES" = "true" ] && [ "$START_LIRCD" = "true" ]; then
load_modules $MODULES
fi
echo -n "Starting lirc daemon:"
if $START_LIRCD; then
echo -n " lircd"
start-stop-daemon --start --quiet --exec /usr/local/sbin/lircd -- $ARGS \
< /dev/null
fi
if $START_LIRCMD; then
echo -n " lircmd"
start-stop-daemon --start --quiet --exec /usr/local/sbin/lircmd \
< /dev/null
fi
echo "."
;;
stop)
echo -n "Stopping lirc daemon:"
echo -n " lircmd"
start-stop-daemon --stop --quiet --exec /usr/local/sbin/lircmd
echo -n " lircd"
start-stop-daemon --stop --quiet --exec /usr/local/sbin/lircd
echo "."
;;
reload|force-reload)
if $START_LIRCD; then
start-stop-daemon --stop --quiet --signal 1 --exec /usr/local/sbin/lircd
fi
if $START_LIRCMD; then
start-stop-daemon --stop --quiet --signal 1 --exec /usr/local/sbin/lircmd
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: /etc/init.d/lircd {start|stop|reload|restart|force-reload}"
exit 1
esac
exit 0
After we create the script we need to make it executable and set it to boot at system startup:
user@host# sudo chmod +x /etc/init.d/lircd user@host# sudo updated-rc.d lircd defaults
Now before we can start the service we need to configure the lircd.conf file to define our remote control buttons. Simply change to the /etc/lirc directory (create it if it does not exist), end edit the lircd.conf file to reflect the following example:
# /etc/lirc/lircd.conf file # This configuration file is for the newer Grey Hauppauge remotes # If this file does not match your remote exactly.. # use the irw command to find your remote control button codes # begin remote name grayHauppauge bits 13 flags RC5 eps 30 aeps 100 one 0 0 zero 0 0 gap 200966 repeat_bit 2 begin codes Power 0x00000000000017BD Go 0x0000000000001FBB TV 0x000000000000179C Videos 0x0000000000001F98 Music 0x0000000000001799 Pictures 0x0000000000001F9A Guide 0x000000000000179B Radio 0x0000000000001F8C Up 0x0000000000001794 Left 0x0000000000001F96 Right 0x0000000000001797 Down 0x0000000000001F95 Ok 0x00000000000017A5 Back/Exit 0x0000000000001F9F Menu 0x000000000000178D Prev-Channel 0x0000000000001F92 Mute 0x000000000000178F Vol+ 0x0000000000001F90 Vol- 0x0000000000001791 Ch+ 0x0000000000001FA0 Ch- 0x00000000000017A1 Record 0x0000000000001FB7 Stop 0x00000000000017B6 Rewind 0x0000000000001FB2 Forward 0x00000000000017B4 Play 0x0000000000001FB5 Previous 0x00000000000017A4 Next 0x0000000000001F9E Pause 0x00000000000017B0 1 0x0000000000001F81 2 0x0000000000001782 3 0x0000000000001F83 4 0x0000000000001784 5 0x0000000000001F85 6 0x0000000000001786 7 0x0000000000001F87 8 0x0000000000001788 9 0x0000000000001F89 0 0x0000000000001780 star 0x0000000000001F8A hash 0x000000000000178E red 0x0000000000001F8B green 0x00000000000017AE yellow 0x0000000000001FB8 blue 0x00000000000017A9 end codes end remote
If the buttons listed above do match your remote control, you can either see other Hauppauge remote control configurations at http://lirc.sourceforge.net/remotes/hauppauge/, or you can find your remote button codes by running irw and pressing buttons on your remote to find the correct HEX values and configure them for the corresponding button names.
After creating the lircd.conf file we need to create a symbolic link from the /etc directory to our new lircd.conf file we just created:
user@host# sudo ln -s /etc/lirc/lircd.conf /etc/lircd.conf
Now we can start the lircd service:
user@host# sudo /etc/init.d/lircd start Starting lirc daemon: lircd.
Now that we have lirc running, let use move on to configuring and installing MythTV itself.
Building MythTV
Again, we have chosen to download and install MythTV from source because the latest version of the Ubuntu MythTV package comes installed with the Myth Transcode Daemon disabled. This becomes an issue if one wishes to backup their own DVD's using MythTV.
To download the latest MythTV source, we need to go to http://www.mythtv.org/modules.php?name=Downloads&d_op=viewdownload&cid=1 and download the MythTV tar.bz2 file, the MythTV Plugins tar.bz2 file, and the MythTV Themes tar.bz2 file directly to your MythTV system.
If you did the full Ubuntu install, you have Mozilla Firefox on the Desktop that you can use to go to the MythTV URL listed. If you did not do the full install, you can apt-get install lynx and use the lynx text-based web browser to download files from the [http://www.mythtv.org/ MythTV website. If you are on another computer, you can transfer the downloaded files via SFTP to your MythTV system.
Once these files are downloaded, they need to be put somewhere on your MythTV system such as in a directory called /usr/src/myth. Once there, we need to extract them:
user@host# cd /usr/src/myth user@host# sudo tar -xjf mythtv-0.19.tar.bz2 user@host# sudo tar -xjf mythplugins-0.19.tar.bz2 user@host# sudo tar -xjf myththemes-0.19.tar.bz2
Once these have been extracted we need to build any and all dependencies that MythTV might rely on in order to compile:
user#host# sudo apt-get build-dep mythtv user#host# sudo apt-get build-dep mythplugins
After the dependencies have been installed, we need to go ahead and start building MythTV.
user@host# cd /usr/src/myth/myth/mythtv-0.19 user@host# export QTDIR=/usr/lib/qt3 user@host# sudo ./configure --prefix=/usr/local/mythtv-0.19 user@host# sudo qmake mythtv.pro user@host# sudo make
Depending on your processor speed, this might take a while.. so order another pizza. After its done we can install the binaries:
user@host# sudo make install
Next we need to configure the mythtv plugins and install them:
user@host# cd /usr/src/myth/mythplugins-0.19 user@host# export QTDIR=/usr/lib/qt3 user@host# sudo ./configure --prefix=/usr/local/mythtv-0.19 --enable-transcode --enable-vcd user@host# sudo qmake mythplugins.pro user#host# sudo make
Sit back and wait, though not quite as long this time. Afterwards we will install the plugins.
user@host# sudo make install
Now finally we need to install the various MythTV themes:
user@host# cd /usr/src/myth/myththemes-0.19 user@host# sudo echo "PREFIX=/usr/local/mythtv-0.19" > mythconfig.mak user@host# sudo qmake myththemes.pro user@host# sudo make install
Now that everything is installed, we need to do a little more configuring befire we go running MythTV. First we need to make some environment changes.
user@host# cd /usr/local user@host# sudo ln -s mythtv-0.19 mythtv
Then we need to create and edit the /etc/ld.so.conf file and add this line to the bottom of the file:
/usr/local/mythtv/lib
And then we can update ld to use the new library path by running:
user@host# sudo ldconfig
Also, we need to edit the /etc/profile file and just before the line which reads "export PATH", place the following line:
PATH=/usr/local/mythtv/bin:$PATH
Now we need to create a MythTV startup script. This script will run everytime the system boots, and will start the mythbackend service. Simply create and edit a file called /etc/init.d/myth-backend, and then populate it with the following:
#! /bin/sh
#
# mythtv-server MythTV capture and encoding backend
#
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/mythtv/bin
DAEMON=/usr/local/mythtv/bin/mythbackend
NAME="mythbackend"
DESC="MythTV server"
test -x $DAEMON || exit 0
set -e
USER=root
RUNDIR=/var/run/mythtv
ARGS="--daemon --logfile /var/log/mythtv/mythbackend.log --pidfile $RUNDIR/$NAME.pid"
EXTRA_ARGS=""
NICE=0
if [ -f /etc/default/mythtv-backend ]; then
. /etc/default/mythtv-backend
fi
ARGS="$ARGS $EXTRA_ARGS"
mkdir -p $RUNDIR
chown -R $USER $RUNDIR
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
start-stop-daemon --start --pidfile $RUNDIR/$NAME.pid \
--chuid $USER --nicelevel $NICE --exec $DAEMON -- $ARGS
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME "
start-stop-daemon --stop --oknodo --pidfile $RUNDIR/$NAME.pid \
--chuid $USER --exec $DAEMON -- $ARGS
echo "."
;;
restart|force-reload)
echo -n "Restarting $DESC: $NAME"
start-stop-daemon --stop --oknodo --pidfile $RUNDIR/$NAME.pid \
--chuid $USER --exec $DAEMON -- $ARGS
echo "."
sleep 3
start-stop-daemon --start --pidfile $RUNDIR/$NAME.pid \
--chuid $USER --nicelevel $NICE --exec $DAEMON -- $ARGS
echo "."
;;
*)
N=/etc/init.d/$NAME
# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
Once this file is created, again we must change the script to be executable and to startup when the system starts up:
user@host# sudo chmod +x /etc/init.d/myth-backend user@host# sudo update-rc.d myth-backend defaults
We should also make sure that the "Myth Transcode Daemon" starts up everytime the system boots.. after all we did go through all the trouble of compiling from source to get this option to work.
We must edit the /etc/init.d/rc.local file and add the following line to the bottom of the file:
/usr/local/mythtv/bin/mtd --daemon
This will start the service everytime the system boots.
Configuring MythTV
Now that the script has been configured, we can finally move on to running myth and setting up its preferences. To do this, simply run the following command:
user@host# sudo mythtv-setup
The MythTV menuing system has very attractive layout, but the navigation controls can leave a little bit to be desired. At this point we a re still using the keyboard to setup our MythTV system. Use the UP and DOWN arrow keys to navigate menu options. Use the LEFT and RIGHT arrow keys to change individual options. Use the ENTER key to select buttons such as "Next", "back", and "Finish". Use the ESC key to go back to previous menus or to cancel. Some individual settings may vary, but for the most part.. if you are using the same hardware listed in this tutorial.. you should be able to use these settings.
Database Configuration
Usually when MythTV setup first launches for the first time, it requests information for the database setup. If you are not prompted for this information, don't worry.. we can still configure it in the "mythfrontend" program. We must define this information before we can populate the guide data with the "mythfilldatabase" program.
Host name: localhost Database: mythconverg User: mythtv Password: password Database Type: MySQL
Of course we would replace the username and password with whatever username and password you granted access to the "mythconverg" database earlier.
General
The only thing you might have to alter here is the option:
Directory to hold recordings
If you wish to alter this, just make sure the directory exists and that it is writable by the user that is running mythfrontend
Capture Cards
In this case we would create a new capture card setting and choose
Analog V4L capture card
The default choices for devices should work here (assuming your Hauppauge capture card is installed and detected by Ubuntu Linux).
Video Device: /dev/video0 VBI Device: /dev/vbi Audio Device: /dev/dsp
Audio tends to be a topic of confusion for many people in dealing with MythTV. For now it is safe to use your default DSP device as your adio input, the reason being that we will use the mini cable that comes with the Hauppauge card to run from the audio out on the capture card to the line in on your sound card.
Default Input: Television
We need to make sure this is set to accept a signal on the "Television" Coaxial input for our Hauppauge capture card. If you plan on using the Composite Input, please consult the documentation for MythTV.
Video Sources
We also need to create a new Video Source. In this case we would name the Video Source something like "Television".
We also need to use the Zap2It account that we created earlier. In the "User ID" and "Password" boxes, we need to put in our Zap2It account information and then choose the "Retrieve Lineups" option to pull in the guide data for our area.
Input Connections
In this case, we would choose the "V4L:/dev/video0 (Television)->television" option. We need to create a display name for this connection and make sure the input for this connection is defined:
Display Name: television Video Source: television
Once we have defined these options, we can exit the MythTV setup program and finally populate our database with the guide data (Remember if you have not defined the username and password with which MythTV will access the database, mythfilldatabase will most likely fail)
user@host# sudo mythfilldatabase
This might take quite a few minutes, as MythTV will fill entries for every channel over the next week or so. Once completed we need to setup our audio card for the correct input to be used. We might need to install a couple more applications to make sure this is done correctly.
user#host sudo apt-get install alsa-oss alsa-tools alsamixergui
Once these applications are installed, we can run the "alsamixergui" and make sure our Line-in is selected as our default in on our soundcard. We do this by finding the channel called "Line" and clicking the circles at the top of the channel so that they are red. This lets us know that this channel is the default "in" source. We also need to make sure this channel is muted, that way we only get sound through this channel when MythTV is running. Make sure the speaker icons on the "Line" channel are not selected green. Aftwerwards we can close the mixer application and make sure these settings are saved.
user@host# sudo alsactl store
This will save the channel settings. We are ready to move on to configuring MythTV to use our remote control.
Configuring MythTV to use LIRC
Next we need to create a file called lircrc for MythTV to pass its commands to the lircd service. This file will exist in the home directory of the user under which mythfrontend runs. We need to change to the user's home directory and create a file called .lircrc and populate it with the following information (note the dot in front of the file name):
# MythTV native LIRC config file for # the new grey Hauppauge remote # # Here we have the jump point commands. They only work if you have # defined function keys for these jump points. For me the most # common command is the menu of recordings, so I put that on "videos" # even though that's counter-intuitive # power buttom begin prog = irexec button = Power repeat = 4 config = /usr/local/bin/mythpowerbutton.sh end begin prog = mythtv button = TV repeat = 3 config = F6 end begin prog = mythtv button = Videos repeat = 3 config = F7 end # Not yet defined begin prog = mythtv button = Music repeat = 3 config = F9 end # Given another function for now, I don't use mythgallery begin prog = mythtv button = Pictures repeat = 3 config = F8 end begin prog = mythtv button = Guide repeat = 3 config = S end # I stuck the "todo" list on here as Myth has no radio function begin prog = mythtv button = Radio repeat = 3 config = F5 end begin prog = mythtv button = Up repeat = 3 config = Up end begin prog = mythtv button = Down repeat = 3 config = Down end begin prog = mythtv button = Left repeat = 3 config = Left end begin prog = mythtv button = Right repeat = 3 config = Right end # Channel Up begin prog = mythtv button = Ch+ repeat = 3 config = Up end # Channel Down begin prog = mythtv button = Ch- repeat = 3 config = Down end # OK/Select begin prog = mythtv button = OK config = Space end # Play begin prog = mythtv button = Play config = Return end # Stop begin prog = mythtv button = Stop config = I end # Escape/Exit/Back begin prog = mythtv button = Back/Exit config = Esc end # Power Off/Exit #begin #prog = mythtv #button = Power #config = Esc #end # Pause begin prog = mythtv button = Pause repeat = 3 config = P end # Mute begin prog = mythtv button = Mute repeat = 3 config = | end # Fast forward (30 sec default) begin prog = mythtv button = Rewind repeat = 3 config = < end # Rewind (10 sec default) begin prog = mythtv button = Forward repeat = 3 config = > end # Skip forward (10 min default) begin prog = mythtv button = SkipForward repeat = 3 config = End end # Skip backward (10 min default) begin prog = mythtv button = Replay/SkipBackward repeat = 3 config = Home end # Record begin prog = mythtv button = Record repeat = 3 config = R end # Delete begin prog = mythtv button = Red repeat = 3 config = D end # Bring up the edit screen begin prog = mythtv button = Green repeat = 3 config = E end # Display EPG while in live TV, # View selected show while in EPG begin prog = mythtv button = Menu/i repeat = 3 config = M end # Scroll up begin prog = mythtv button = Vol+ repeat = 3 config = F11 end # Scroll down begin prog = mythtv button = Vol- repeat = 3 config = F10 end # Bring up OSD info begin prog = mythtv button = Go repeat = 3 config = I end # previous channel begin prog = mythtv button = Prev.Ch repeat = 3 config = H end # tag a recording, in the Recordings section begin prog = mythtv button = Yellow repeat = 3 config = Y end # change tuners begin prog = mythtv button = # repeat = 3 config = C end # load the cut list while editing begin prog = irexec button = Blue repeat = 0 config = /usr/local/bin/osd.sh end # load the cut list while editing #begin #prog = mythtv #button = Blue #repeat = 3 #config = Z #end # Numbers 0-9 begin prog = mythtv button = 0 repeat = 3 config = 0 end begin prog = mythtv button = 1 repeat = 3 config = 1 end begin prog = mythtv button = 2 repeat = 3 config = 2 end begin prog = mythtv button = 3 repeat = 3 config = 3 end begin prog = mythtv button = 4 repeat = 3 config = 4 end begin prog = mythtv button = 5 repeat = 3 config = 5 end begin prog = mythtv button = 6 repeat = 3 config = 6 end begin prog = mythtv button = 7 repeat = 3 config = 7 end begin prog = mythtv button = 8 repeat = 3 config = 8 end begin prog = mythtv button = 9 repeat = 3 config = 9 end ### MPlayer lirc setup # Show OSD begin prog = mplayer button = Menu/i repeat = 3 config = osd end # Pause playback begin prog = mplayer button = Pause repeat = 3 config = pause end # Skip ahead a minute if playing # If paused, resume playing begin prog = mplayer button = Play repeat = 3 config = seek +1 end # Stop playback and exit begin prog = mplayer button = Stop repeat = 3 config = quit end # Mute begin prog = mplayer button = Mute repeat = 3 config = mute end # Seek back 10 seconds begin prog = mplayer button = Rewind repeat = 3 config = seek -10 end # Seek forward 30 seconds begin prog = mplayer button = Forward repeat = 3 config = seek +30 end # Quit begin prog = mplayer button = Back/Exit repeat = 3 config = quit end # Seek forward 10 minutes begin prog = mplayer button = SkipForward repeat = 3 config = seek +600 end # Seek backward 10 minutes begin prog = mplayer button = Replay/SkipBackward repeat = 3 config = seek -600 end # Toggle full-screen begin prog = mplayer button = Prev.Ch repeat = 3 config = vo_fullscreen end ### Xine lirc setup begin prog = xine button = Play repeat = 3 config = Play end begin prog = xine button = Stop repeat = 3 config = Quit end #begin #prog = xine #button = OFF #repeat = 3 #config = Quit #end begin prog = xine button = Pause repeat = 3 config = Pause end begin prog = xine button = Up repeat = 3 config = EventUp end begin prog = xine button = Down repeat = 3 config = EventDown end begin prog = xine button = Left repeat = 3 config = EventLeft end begin prog = xine button = Right repeat = 3 config = EventRight end begin prog = xine button = OK repeat = 3 config = EventSelect end begin prog = xine button = Back/Exit repeat = 3 config = Menu/i end begin prog = xine button = Forward repeat = 3 config = SpeedFaster #config = SeekRelative+60 end begin prog = xine button = Rewind repeat = 3 config = SpeedSlower #config = SeekRelative-60 end begin prog = xine button = Vol+ repeat = 3 config = Volume+ end begin prog = xine button = Vol- repeat = 3 config = Volume- end begin prog = xine button = Mute repeat = 3 config = Mute end begin prog = xine button = Menu/i repeat = 3 config = RootMenu end begin prog = xine button = Guide repeat = 3 config = RootMenu end begin prog = xine button = SkipForward repeat = 3 config = SeekRelative+60 #config = EventNext end begin prog = xine button = Replay/SkipBackward repeat = 3 config = SeekRelative-60 #config = EventPrior end begin prog = xine button = Go repeat = 3 config = OSDStreamInfos end begin prog = xine button = Red repeat = 3 config = Quit end begin prog = xine button = Yellow repeat = 3 config = Eject end
Once this file has been created, we can either copy it or make a symbolic link to it in the user's .mythtv directory.
user@host# cd ~ user@host# cp .lircrc ~/.mythtv/lircrc
Configuring MythWeb
MythWeb will allow us to connect to the MythTV system remotely and schedule recordings and other various remote functions. This is a handy feature if we wish to schedule a recording but are not at home to do so.
Getting MythWeb up and running with basic functionality is a straightforward process. If you remember earlier, we had extracted the mythtv-plugins in our /usr/src/ directory. We need to copy the MythWeb directory over to our running Apache web directory and configure Apache to use the MythWeb as its web content:
user@host# sudo cp -Rf /usr/src/myth/mythplugins-0.19/mythweb /var/www/ user@host# sudo chown -R www-data /var/www/mythweb user@host# sudo chgrp -R www-data /var/www/mythweb
This will copy the MythWeb directory over and change permissions on the directory to allow the Apache web server to use it. We now need to make a few Apache configuration changes.
First let us edit the /etc/apache2/httpd.conf file and add the following line to the bottom:
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
Next we need to edit the /etc/apache2/sites-available/default file and make a few changes so that Apache will use the MythWeb directory:
DocumentRoot /var/www/mythweb <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/mythweb/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all # Uncomment this directive is you want to see apache2's # default start page (in /apache2-default) when you go to / #RedirectMatch ^/$ /apache2-default/ </Directory>
Do not add these lines to the configuration file, just change the existing configuration to reflect this example. Note the AllowOverride All line under the defined Directory for MythWeb. This is important because it allows us to access the MySQL database correctly with MythWeb.
Now we just need to edit the /var/www/mythweb/.htaccess file and put the correct information in for database access.
setenv db_server "localhost" setenv db_name "mythconverg" setenv db_login "mythtv" setenv db_password "password"
Again, do not add these lines to the .htaccess file, just edit the section shown above to reflect the example. Be sure and use the correct username and password that you wish to access the MySQL database with for MythTV.
Now we should be able to restart the Apache webserver and access it via its IP address:
user@host# sudo /etc/init.d/apache2 restart
Once the webserver has restarted, point a web browser from another computer on your local network to the IP address of your MythTV system. If you are not sure what your IP address is, either run ifconfig -a from a shell (terminal) or check the settings in your Network Configuration option from your Gnome window manager.
At this point MythWeb is up and running.
Running MythTV
We are now ready to launch the "mythfrontend" application and test all of this out. From a shell (terminal), simply run:
user@host# mythfrontend
This might take a minute or so the first time, as the frontend is building and scaling images to the defined layout of our screen.
Once this is launched, we should try using our remote control to navigate menu options. If for any reason the remote fails to move menu options, we should probably double check our configurations files for lirc and their locations.
If the menu options do respond to the remote, we can go forward in configuring the various other MythPlugins under the Utilities/Setup option. Some of these plugins include
- MythMusic: A frontend to play music CDs and Mp3s
- MythDVD: A Myth frontend that plays and copies DVD's
- MythWeather: Pugin that interfaces with weather.com
- MythFlix: Interface for Netflix accounts
- MythPhone: SIP based Voice over IP plugin for MythTV
- MythGallery: Frontend Picture/Photo Gallery for MythTV
- MythNews: Configurable Web-based News Feeds.
Configuring most of these plugins should be pretty self-explanatory. If you have any additional questions about the way these plugins work, please consult the MythTV documentation.
From here we should probably test out the most important feature of all: Watching Live TV.
Some users have initial problems with watching Live TV based on one issue; the configuration of the BTTV drivers for their Hauppauge cards.
Assuming "mythfilldatabase" has been run, and the guide data has been populated, choose the "Watch TV" option. If you get no picture at this point.. then a little adjusting needs to be done to the BTTV drivers.
In our case, we are using the Hauppauge WinTV GO-Plus capture card. There are specific card and tunner settings that need to be applied for this card to work correctly.
To set these options, we need to create a file in the /etc/modprobe.d directory called bttv and set up some configuration options for the card to work properly
user@host# sudo touch /etc/modprobe.d/bttv
Then we can edit this file and put in the following options:
options bttv radio=1 card=26 tuner=39 gbuffers=10
In this case we enabled the Radio feature as well on the card, though the options we put here will largely depend on what model of Hauppauge WinTV card we have. You might have to adjust the card number and tuner number based on your model. For a more complete list of card and tuner numbers supported by bttv, please refer to the MythTV BTTV wiki.
Once we have configured the card and tuner types, we can either reload the bttv modules or reboot the system (module reloading is much quicker). We must make sure "mythfrontend" and "mythtv-backend" are both not running. Exit out of the frontend and then we can stop the backend and reload the modules and try again.
user@host# sudo /etc/init.d/mythtv-backend stop user@host# sudo rmmod tuner && rmmod bttv user@host# sudo modprobe bttv user@host# sudo /etc/init.d/mythtv-backend start
We can now launch the "mythfrontend" application and try again. If this still does not work, keep adjusting the card and tuner types and repeat the process listed above until you find a combination that works for you.
Once you have a working combination that get a good television signal, its now time to put the finishing touches on the MythTV system so that we can plug it up to our TV.
Final Touches
At this point we have done all the major work to get MythTV up and running. Now we just need to make some minor tweaks such as configuring an autologin account that will start MythTV frontend everytime the computer boots.
This is a straightforward process. In Ubuntu Linux, we have some menus at the top of our Gnome window manager that will configure these options for us. Under the "System" menu at the top, go to "Administration" and choose the "Login Window" option. This should prompt the user to enter his/er password in order to change system settings.
Once into the "Login Window Preferences", choose the "Securoty" tab and check the box titled "Enable Automatic Login". Choose your username that runs MythTV from the drop down list below and click the "Close" button.
Now that This user account will automatically login, we need to make sure MythTV launches after the account logs in. Under the "System" menu at the top, go to "Preferences" and choose the "Sessions" option. Once the "Sessions" window comes up, choose the "Startup Programs" tab and choose "Add" to add a new startup program. In this case we will add mythfrontend as our startup command. Once this is added, go ahead and reboot the sytem to verify that our settings have taken effect.
Once the system has rebooted, the only thing left to configure is the TV out settings for our video card. As stated earlier, we are using an Nvidia chipset.. and with the packages we added earlier, we can easily configure our display to go out to the SVideo output as well as our monitor at the same time.
We can accomplish this task by making entries in (or even replacing) the /etc/X11/xorg.conf file. Before we do this, we want to make a backup in case anything goes wrong.
user@host# sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup
Now we can either edit the entries in this file, or replace it with the following example:
# /etc/X11/xorg.conf (xorg X Window System server configuration file)
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
# sudo dpkg-reconfigure -phigh xserver-xorg
Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen" 0 0
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
EndSection
Section "Files"
# path to defoma fonts
FontPath "/usr/share/X11/fonts/misc"
FontPath "/usr/share/X11/fonts/cyrillic"
FontPath "/usr/share/X11/fonts/100dpi/:unscaled"
FontPath "/usr/share/X11/fonts/75dpi/:unscaled"
FontPath "/usr/share/X11/fonts/Type1"
FontPath "/usr/share/X11/fonts/100dpi"
FontPath "/usr/share/X11/fonts/75dpi"
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
EndSection
Section "Module"
Load "i2c"
Load "bitmap"
Load "ddc"
Load "extmod"
Load "freetype"
# Load "glx"
Load "int10"
Load "type1"
Load "vbe"
EndSection
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc104"
Option "XkbLayout" "us"
EndSection
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ExplorerPS/2"
Option "ZAxisMapping" "4 5"
Option "Emulate3Buttons" "true"
EndSection
Section "Monitor"
Identifier "Generic Monitor"
HorizSync 31.5 - 48.5
VertRefresh 70
Option "DPMS"
ModeLine "960x540p" 37.26 960 976 1008 1104 540 542 548 563 +hsync +vsync
EndSection
Section "Device"
Identifier "NVIDIA Corporation"
Driver "nvidia"
Option "DPMS"
Option "IgnoreEDID" "1"
Option "TVStandard" "NTSC-M"
Option "TVOutFormat" "SVIDEO"
Option "TVOverScan" "0.6"
Option "ConnectedMonitor" "tv"
Option "TwinView" "true"
Option "TwinViewOrientation" "Clone"
Option "SecondMonitorHorizSync" "30-50"
Option "SecondMonitorVertRefresh" "60"
Option "MetaModes" "1024x768,1024x768;800x600,800x600;640x480,640x480;512x384,512x384"
EndSection
Section "Screen"
Identifier "Default Screen"
Device "NVIDIA Corporation"
Monitor "Generic Monitor"
DefaultDepth 24
SubSection "Display"
Depth 1
Modes "1280x1024" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 4
Modes "1280x1024" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 8
Modes "1280x1024" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 15
Modes "1280x1024" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 16
Modes "1280x1024" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 24
Modes "1280x1024" "1024x768" "800x600" "640x480"
EndSubSection
EndSection
Note the entries for the default mouse. If you are using a PS/2 based mouse, and maybe not using a USB mouse, correct these entries with the entries from your original xorg.conf.backup file. Yhis will eventually be irrelevent once the system is hooked up to the Television.. we will not need a mouse then. Also note that here we are cloning the output of our Monitor to the S-Video output of the Nvidia card.
Now we should be able to connect an S-Video cable out of our Nvidia card directly into the input of a Television. You might want to play with the horizontal/vertical refresh settings and resolution modes if you find these settings do not work well for you.. but generally they should work for most televisions.
From here, all you need is to connect the Audio Line Out (or Multiple Lines Out) from your soundcard to your television or stereo receiver/amplifier. Adapter cables that go from mini jack out to RCA audio in can usually be purchased at your local Radio Shack or other Electronics Store.
At this point, we need to make sure the BIOS for the system is not halting when a keyboard or monitor is not connected to it. Be sure and change any BIOS settings to correct this problem. Now we should have a basic functioning MythTV Home Media Center running. Enjoy!

