This is an old revision of the document!
Table of Contents
Introduction
Just for kicks, I wanted to put together my own Tivo/PVR device. I've had DirectTV with Tivo for a few years, and it was great, BUT I always wanted the option to have the .mpg file off the tivo. I knew you could hack the series 1 (I have a series 2 and the ones are pricey on eBay) pretty easily to give you this, but I also didn't want to constantly fix it when new revisions came out. What pushed me over the edge was the price bundling. I only watch a few shows on a few channels, and I didn't feel I needed to pay $75/mo for that honor. I bought a HDTV tuner card for kicks and put together a little media PC and could not believe the quality of the over the air HDTV. The little computer was having trouble de-interlacing the 1080i channels, so I immediately bought a bigger machine to dedicate to the PVR and went about putting together Hal. This is a compilation of my install notes from the two Myth boxes I made (the little one is megaweapon and the big one is hal). It turns out that my little box CAN keep up with viewing HDTV after I tweaked its settings, so now I have two machines.
I chose Slackware as my Linux distribution because that is what I have been using since around 1995, when someone at work mentioned one of our co-workers wrote a lot of the network drivers for this thing called Linux and you have to try it.
Hardware Used
E-Machines T6524 right from BestBuy's shelves as our base
- Processor 2.2 GHz AMD Athlon 64 3500+
- 2 GB of PC3200 ram [added 1 GB]
Integrated ATI RADEON XPRESS 200< – disabled itIntegrated Realtek AC97 Audio< – disabled it- BFG Tech BFGR6600GTOCX Geforce 6600GT 128MB GDDR3 PCI Express x16 Video Card
Creative Labs Sound Blaster Live!replaced this old card on 2006/04/21 with:- AOpen Cobra 7.1 AW-870LP (because it is supported by linux and has optical digital output)
- Hard drive size 200 GB (NTFS Windoze Media Edition) [added a 160 GB Samsung for Linux]
- Stream Zap USB remote control.
- ATI HDTV WONDER (installed 2006/04/21)
System Setup
- Slackware 10.2 Full Install as base
- Compiled kernel 2.6.16.9 (2006/04/22)
- Kernel 2.6.15.4 - Config: kernel.config.txt
- X11 IA32-Nvidia NVIDIA-Linux-x86-1.0-8178-pkg1.run - Config: xorg.conf
This is approximately the order that I installed these libraries and software to get MythTV installed on my Slackware box.
Initial Packages
LAME
lame-3.96.1 LAME Download Home(from SourceForge)
./configure make make install
LIRCD
lirc-0.8.0 (from Sourceforge)
- Don't forget you need to make USB all modular (since the stream zap is a module)
- Don't forget to make unloadable modules for your 2.6 kernel
For some reason, you need to edit this line out of this file for LIRCD to compile:
line 180 of /usr/local/src/mythtv/lirc-0.8.0/drivers/lirc_streamzap/lirc_streamzap.c
static struct usb_driver streamzap_driver = { /* .owner = THIS_MODULE, */ .name = DRIVER_NAME, .probe = streamzap_probe, .disconnect = streamzap_disconnect, .id_table = streamzap_table, };
add this line to /etc/modprobe.conf
alias char-major-61 lirc_gpio
Add LIRC items to your config files: /etc/udev/rules.d/udev.rules
# lircd - dlr 20060111 KERNEL="lirc[0-9]*", NAME="lirc/%n" , MODE="0666"
./configure make make install
Here is my /etc/lircrd.conf - lircd.conf
I had this with a fancy LIRCD start/stop script, but it was breaking my installation. I think I was forcing the device and it didn't like that. In my latest try, I've just added this to my /etc/rc.local at it appears to be working fine:
# LIRC daemon /usr/local/sbin/lircd
Create for your user: ~/.mythtv/lircrc
MythTV Core
mythtv-0.19 (MythTv.org )
TIP: –enable-proc-opt is VERY important for HDTV playback
# link this so we can find qt ln -s /opt/kde /opt/kde3 ./configure --disable-audio-arts --enable-firewire --enable-proc-opt --enable-dvb --enable-xvmc --disable-joystick-menu qmake mythtv.pro make make install # SETUP MYSQL (see below) mythtv-setup mythfilldatabase
Here is what I have added to my /etc/rc.d/rc.local to get mythtv running:
#echo 'Fire up MythTv Backend' cd /root/.mythtv ; /usr/local/bin/mythbackend & #echo 'Fire up MTD ripping daemon' /usr/local/bin/mtd -d
Modify your /etc/inittab to set your system to level 4 (graphics mode)
MYSQL
<GO SETUP MYSQL - See the MythTV docs. I like to use http://www.phpmyadmin.net/home_page/index.php for helping configure MYSQL> <You also should go setup where you're going to get your guide information from: I use zap2it>
# it is NOT rubberchicken BTW lol mysql> SET PASSWORD FOR root@localhost=PASSWORD('rubberchicken'); Query OK, 0 rows affected (0.06 sec) mysql>
here is my phpmyadmin config.inc.php file: (which goes right in the main phpmyadmin directory)
<?php /* * Generated configuration file * Generated by: phpMyAdmin 2.8.0.3 setup script by Michal .iha. <michal@cihar.com> * Version: $Id: setup.php,v 1.23.2.2.2.1 2006/03/08 19:06:48 nijel Exp $ * Date: Fri, 05 May 2006 07:29:41 GMT */ /* Servers configuration */ $i = 0; /* Server 10.0.0.3 (config:root) [1] */ $i++; $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['extension'] = 'mysql'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = 'rubberchicken'; $cfg['Servers'][$i]['verbose'] = '10.0.0.3'; /* End of servers configuration */ ?>
Insert the MythTv mysql database:
cd /usr/local/src/mythtv/mythtv-0.19/database/ mysql -u root -p < mc.sql
File Structure
- Add mythtv to the audio,disk and video groups
mkdir /usr/local/share/store chgrp disk /usr/local/share/store chmod g+w /usr/local/share/store ln -s /usr/local/share/store /mnt/store
MythTV Plugins And Libraries
mythplugins-0.19
myththemes-0.19
libdvdread
libdvdread-0.9.6 (From Freshmeat )
Home / download page is here: http://www.dtek.chalmers.se/groups/dvd/downloads.shtml
./configure make make install
libdv
libdv-0.104 (Sourceforge)
./configure make make install
mjpegtools
mjpegtools-1.8.0 (From Sourceforge)
I ran this after already setting my kernel to Athlon64 and it complained about -k8 not being a valid CPU arch type. Modify this file in the distribution cpuinfo.sh (around line 139):
15) # Despite what the gcc into says 'athlon64' is not accepted as # synonym for 'k8' proc=k8 ;; *) proc=athlon-xp ;;
Just change the k8 (which was failing for me) to athlon-xp and then re-run .configure.
# to find libdv, i had to add this: export PKG_CONFIG_PATH='/usr/local/lib/pkgconfig' ./configure make make install
xvid
xvidcore-1.1.0 (http://www.xvid.org)
cd build/generic/ ./configure make make install
a52dec
a52dec-0.7.4 (Directly from the development page )
./configure make make install
libfame
libfame-0.9.1 (Sourceforge Page )
./configure make make install
mpeg2dec
mpeg2dec-0.4.0b (From Sourceforge)
./configure make make install
libtheora
libtheora-1.0alpha5 (The Theora development page)
./configure make make install
libogg
libogg-1.1.2 (The Theora development page)
./configure make make install
libvorbis
libvorbis-1.1.1 (The Theora development page)
./configure make make install
libdvdcss
libdvdcss-1.2.9 (Video Lan Development page )
./configure make make install
libid3tag
libid3tag-0.15.1b (Sourceforge Page )
./configure make make install
flac
flac-1.1.2 (Sourceforge)
./configure make make install
libcdaudio
libcdaudio-0.99.12p2 (Sourceforge)
./configure make make install
fftw
fftw-2.1.5 (Their development page)
./configure make make install
faad2
faad2-2.0 (Sourceforge)
NOTE: After you generate the Makefile you need to edit out the bottom. It is broken.
autoreconf -vif ./configure # edit the Makefile and REMOVE the bottom RPM section (it is broken and we aren't doing that anyway) make make install
x264
http://www.videolan.org/developers/x264.html
svn co svn://svn.videolan.org/x264/trunk x264 cd x264 ./configure make make install
ffmpeg
ffmpeg-0.4.9-pre1
download from CVS:
# cvs -z9 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co ffmpeg svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
# latest compile on megaweapon ./configure --enable-liba52 --enable-shared --enable-gpl --cpu=athlon-xp --enable-libmp3lame \ --enable-libogg --enable-libvorbis --enable-libtheora --enable-libfaad --enable-xvid --enable-pthreads \ --enable-x264 ./configure --enable-a52 --enable-shared --enable-gpl --cpu=athlon-xp --enable-mp3lame \ --enable-libogg --enable-vorbis --enable-libtheora --enable-faad --enable-xvid --enable-pthreads \ --enable-x264 # for the 64bit athlon ./configure --enable-a52 --enable-shared --enable-gpl --cpu=athlon-xp --tune=athlon-xp --enable-mp3lame \ --enable-libogg --enable-vorbis --enable-theora --enable-faad --enable-xvid --enable-pthreads # for the new box (pentium 4 celeron) ./configure --enable-a52 --enable-shared --enable-gpl --cpu=pentium4 --tune=pentium4 --enable-mp3lame \ --enable-libogg --enable-vorbis --enable-theora --enable-faad --enable-xvid --enable-pthreads make make install # find this file and put it in /usr/include (I think I had to download it somewhere) cp mp4ff_int_types.h /usr/include/
TIP: - Here is my mp4ff_int_types.h.txt
NOTE: I found this in the FAAD source tree:
cp /usr/local/src/mythtv/faad2/common/mp4ff/mp4ff_int_types.h /usr/local/include/
transcode
transcode-1.0.2 (Transcode Main Page)
./configure --enable-libfame --enable-sdl --enable-a52 --enable-ogg --enable-vorbis --enable-theora --enable-libdv --enable-gtk \ --enable-mjpegtools --with-mjpegtools-includes=/usr/local/include/mjpegtools make make install
MPlayer
MPlayer-1.0pre7try2 (MPlayer main page)
ALL Linux x86 Codecs
./configure make make install # untar the codecs into /usr/local/lib/codecs and link it as well: tar -jxvf ../all-20050412.tar.bz2 mv all-20050412 /usr/local/lib/codecs ln -s /usr/local/lib/codecs /usr/local/lib/win32
DVB Devices
In order to get the DVB device working (my capture card requires this interface):
Go here and download: LinuxTV
Here is my script: makedev-dvb.sh.txt
# DVB in the kernel # need to download dvb-kernel from http://linuxtv.org # and run this: (all you need are the devices and the modules working and you're good to go) /usr/src/dvb-kernel# ./MAKEDEV-DVB.sh
MythTv Plugins
./configure --enable-all --disable-festival qmake mythplugins.pro make install
MythTv Themes
./configure make install
File System Setup
mkdir /usr/local/share/store/ chgrp disk /usr/local/share/store/ chmod g+w /usr/local/share/store/ ln -s /usr/local/share/store /mnt/store
Tips, Tricks and Notes
- For the X11 setup to keep up with HDTV playback, be sure you add: Option “RenderAccel” “true” to your X11 configuration (see above).
- You MUST compile kernel USB support as modules since LIRC for the Stream Zap remote must be a module.
- Since we're recording using HDTV capture board, you must turn on large audio buffers to keep the sound from crackling.
- Get LIRCD up and running BEFORE you compile MPlayer as it will autodetect it if you have it up when you compile MPlayer. (So the remote will work while watching Video, not Recordings)
- EDIT /etc/rc.d/rc.mysql “SKIP NETWORKING TRUE!” is the default in Slackware 10.2 !?!?!?! argh…. 1 hour wasted figuring out why I couldn't connect to the database remotely!?
Support Configurations
Compiling Apache 2.0
In order to get our web based interface to allow you to click the movies and transfer them (they're big, because HDTV is BIG!), we'll need apache 2.0 on our server. I initially downloaded a 'package' from linuxpackages.net for apache2, php5 and mysql. That all worked with just a little tweaking on the /etc/apache2/httpd.conf file. That package, however, did not have big files enabled… argh. Here is my effort to compile apache 2.0 myself and replace these binaries with my own.
in the source for slackware, modify the config.layout and add this section:
# Layout for Slackware Linux <Layout Slackware> prefix: /usr exec_prefix: ${prefix} bindir: ${prefix}/bin sbindir: ${prefix}/sbin libdir: ${prefix}/lib libexecdir: ${prefix}/lib/apache2 mandir: ${prefix}/man sysconfdir: /etc/apache2 datadir: /var/www iconsdir: ${datadir}/icons htdocsdir: ${datadir}/htdocs manualdir: ${datadir}/manual cgidir: ${datadir}/cgi-bin includedir: ${prefix}/include/apache2 localstatedir: /var runtimedir: ${localstatedir}/run logfiledir: ${localstatedir}/log/apache2 proxycachedir: ${localstatedir}/cache/apache2 infodir: ${exec_prefix}/share/info installbuilddir: ${datadir}/build errordir: ${datadir}/error </Layout>
export CFLAGS="-pipe -O2 -march=i486" export CPPFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" export CXXFLAGS="-pipe -O2 -march=i486" # Configure it as follows: ./configure --enable-layout=Slackware \ --enable-module=all \ --enable-mods-shared=all \ --enable-deflate \ --enable-ssl=shared \ --enable-proxy \ --enable-dav
(the deflate option is important as most sites save bandwidth using deflate, as well as mod_proxy and some other ones that isnt included by default)
Compiling PHP 5
./configure \ --disable-cgi \ --enable-force-cgi-redirect \ --enable-mbstring \ --prefix=/usr \ --with-apxs2=/usr/sbin/apxs \ --with-config-file-path=/etc/apache2 \ --with-gdbm \ --with-gettext \ --with-mysql=shared,/usr \ --with-xml \ --with-zlib
Compiling Xine
So we can use the remote, we need to compile our own xine so it seems that LIRC is running.
Just grab the source off a slackware page and build the package like they do:
cd /usr/local/src/ mkdir xine cd xine wget ftp://slackware.mirrors.tds.net/pub/slackware/slackware-11.0/source/xap/xine-ui/* chmod 755 xine-ui.SlackBuild ./xine-ui.SlackBuild installpkg /tmp/xine-ui-0.99.4-i686-3.tgz
MythWeb Through the Firewall
I prefer to use MythWeb to using the remote to pick programs to record and browsing the guide. If I forget to record something or need to change what the box was up to I want to reach it remotely.
I found this apache httd.conf configuration trick for getting to your MythTv box through your firewall (if your firewall happens to be a machine running apache). I was Googling for a method to get MythWeb to run on a machine that didn't have the backend running and this came up and works like a charm. The only suggestion I would have is add a .htaccess to your myth box so that it is password protected, since you don't want strangers filling up your HD with silly shows or deleting something you really like. The ProxyPass allows the traffic to just funnel through your main outside accessable machine to your machine behind the firewall. (I have 2 nics in my main box one for the WAN and one for the LAN)
Here is what I added to my virtual hosts with the names changed to protect the innocent:
<VirtualHost www.YOURMYTHTVDOMAIN.com> ProxyPass / http://10.0.0.42/ ProxyPassReverse / http://10.0.0.42/ ServerAdmin admin@YOURMYTHTVDOMAIN.com DocumentRoot "/var/www/htdocs/mythtv" DirectoryIndex index.html Servername www.YOURMYTHTVDOMAIN.com ErrorLog logs/www.YOURMYTHTVDOMAIN.com-error_log TransferLog logs/www.YOURMYTHTVDOMAIN.com-access_log </VirtualHost>
Samba
You HAVE to share (it is a moral imperative) your newly recorded programs with your LAN. (so maybe some lucky hacker will find your network)
Here is my /etc/samba/smb.conf smb.conf
ToDo
- Should I attempt 64bit slackware? It specifically says something about X11 KDE things being a problem!?
Samples & Results
- I love this thing. It costs $0/month to have HDTV recording to a local drive shared to the LAN.
- The quality of over the air ATSC HDTV is just amazing. I never imagined it would be so clear and at such a high bitrate over a UHF antenna.
MythTv Upgrade
Since the listings went away due to the abuse of ZapToIt Labs… I have paid for the subscription to the non-profit listings, forcing an upgrade of mythtv, so I might as well document what I did to get it up and going again.
- BACKUP your database before you do this, i nixed my card, and now it won't find it…ARGH!
- kill (killall) the running daemon on the backend and I took the front end machine to run level 3 effectively killing that machine too.
- uploaded all the code to /usr/local/src/mythtv-0.20.2 and untar it there.
Backend:
cd mythtv-0.20.2 ./configure --disable-audio-arts --enable-firewire --enable-proc-opt --enable-dvb --enable-xvmc --disable-joystick-menu qmake mythtv.pro make make install mythtv-setup mythfilldatabase # plugins ./configure --enable-all --disable-festival qmake mythplugins.pro make install #themes ./configure make install
Frontend:
cd mythtv-0.20.2 ./configure make make install # plugins ./configure --enable-all --disable-festival qmake mythplugins.pro make install #themes ./configure make install