|
|
Mark's Myth TV Page
| |
How I set up my MythTV box
| |
This is the chronicle of how I set up my MythTV PVR
box. MythTV is a very cool open source personal video recorder program and much, much
more. I am deeply grateful for all the work the MythTV team has put in on it; it has
provided my family with hours and hours of enjoyment and made my cable bill worth paying.
| |
Hardware
|
I am using a basic AMD Duron platform. The specs:
- Motherboard: BioStar M7VIZ v8.x
The M7VIZ has on-board sound, video, and networking, in
addition to 4 USB ports, and the standard array of those archaic DB-25,
DB-15, and DB-9 connectors. The sound is an AC'97 6-channel audio
chip, which I am not using, because the interface is all analog. (Who wants
to run 3 twisted pairs anywhere?) The video is a Unichrome 2D/3D system, which
I also am not using, because I need a TV out card. The network is a VIA chip which
uses the via-rhine driver.
My old motherboard was an ASRock K7VM2.
It also has on-board sound, video, and networking, 4 USB ports, etc. It was
a pretty good fit because it had pretty basic sound and graphics so I didn't
feel as bad about not using them. However, the on-board network adapter quickly
failed (after about 3 months). Later on, it developed this really weird problem
where my PVR-250 would become inaccessible after putting the AGP graphics card
into a high-resolution mode. After many hours diagnosing it, including swapping
out video capture cards and graphics cards, I bought the new motherboard and
everything began working again. Email me
if you're interested in what the symptoms were.
- CPU: AMD Athlon XP 2000+
It was cheap at the time.
- Memory: 256MB DDR266
Kingston. I had a bad stick at first and they were pretty good about replacing it. I used a Knoppix distribution and MEMTEST86 to figure out the problem.
- Video: nVidia GeForce4 MX440 128MB (Apollo Bloody Monster)
Naturally, to do TV out, you are extremely limited in which video cards you
can choose. I originally had a Matrox G450 card, but I had so many problems
making it work that I sold it and got the nVidia card.
- TV Capture: Hauppauge PVR-250
Has an onboard MPEG2 encoder. You can actually
cat </dev/video0 >out.mpg
and get raw MPEG2 video as simply as that. Sweet!
Contrary to what some websites have said, the PVR-250 does not also have an
MPEG2 decoder onboard.
Sound: Creative SBLive
Uses the emu10k1 driver.
Drives: 40GB, 80GB, and 200GB
I just buy what's cheap at the time, as long as it's a name brand. I have two Maxtors and a Western Digital.
Optical: None!
I used to use my Myth box for viewing DVDs, but you can get a new DVD player
for $29, so why bother doing it with Myth? Plus, this lets me remotely locate my box.
Power Supply:
The list above seems like an awful lot to cram into one of those Micro ATX cases
with those itty bitty 150 Watt power supplies, doesn't it? Well, with my old
motherboard, for some reason everything worked for a good 18 months. Once I got
my new motherboard, my power supply lasted about 3 minutes until I smelled smoke
and it shut off. Now I've shoehorned a 250 Watt ATX supply in there, and boy
does it look like a Frankenstein. I'd have bought a new case and a full ATX
motherboard if I'd anticipated this...
| |
Notable BIOS settings
|
- AGP Mode: 4x
- AGP Aperture Size: 64MB
- Onboard VGA Share Memory: None
- Primary Graphics Adapter: AGP
- Onboard Serial Port: DISABLED
- Onboard Infrared Port: DISABLED
- Onboard Parallel Port: DISABLED
- Ohboard MIDI Port: DISABLED
- Onboard Game Port: DISABLED
- Onboard AC'97 Audio: DISABLED
- Onboard MC'97 Modem: DISABLED
The idea here is twofold: to make sure the video card runs under AGP 4x (I think
it can do 8x), and to disable things you
aren't using. I will eventually get lirc going,
so I'll have to enable the serial port (?or my infrared port?). I assume that
disabling hardware I'm not using will prevent modules from being loaded and possibly
free up valuable resources.
| |
Operating system
|
Fedora Core 3. I installed everything and took all the updates. Then I made the following changes:
- In /etc/inittab, delete (or comment out) all but one of the /sbin/mingetty lines. No need to
have multiple virtual terminals if they will never be used.
- In /etc/X11/gdm/gdm.conf, change the DisallowTCP line to "DisallowTCP=false", removing the
comment character (#) on the front. I keep my Myth box behind a firewall and I like to be
able to open X Windows from it on my iBook every now and then. The default configuration is to
disallow X Windows over TCP; this allows it.
- If your Myth box is behind a proxy, add a line to your .cshrc (or whatever is appropriate
for your shell) indicating such. For most programs it's an environment variable named
http_proxy, set to "http://yourproxy:3128", for example.
|
Enabling the TV Out section of the video card under X
| |
You have to do some work to allow the TV out to work under X Windows.
First, you have to download the nVidia
Linux drivers. You might do well to hit the archives page and download all previous
versions of the driver, just so you can swap them in and out.
- If you are running X, exit X by executing 'telinit 3' as root. This will tear down X
and leave you with a text console.
- As root, run the installer. nVidia has a canned installer (shell script) but it seems to
work OK when I use it. Note: You must re-run this installer if you upgrade or rebuild
your kernel.
Next, you have to tell X about the nVidia driver and set up the card. Make the following changes
to the file /etc/X11/xorg.conf. Note: I gathered
this information from various places on the internet. I don't know who to thank for the help
just now, but if you find similar info elsewhere on the internet, it's probably they
who came up with it, not me.
- In the "Module" section, comment out or delete this line:
# Load "dri"
No idea why.
- Add a "ServerFlags" section:
Section "ServerFlags"
Option "AllowMouseOpenFail" "yes"
Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
EndSection
I think the first line allows X to run without a mouse.
The rest of the lines tell X to disable screen blanking when idle. You don't want
to have to hit a key every 10 minutes or so while you're watching TV.
Note: This doesn't work.
- In the "Monitor" section, change these parameters to:
ModelName "0"
HorizSync 31.5 - 57.0
VertRefresh 50.0 - 70.0
This lets you play better with a TV rather than a monitor.
- In the "Device" section, X should have autodetected your nVidia card and set it
up to use the "nv" driver. You want the vendor-supplied driver, so change that line to:
Driver "nvidia"
Also add these lines to that section:
Option "NvAGP" "1"
Option "NoLogo" "true"
Option "HWCursor" "true"
Option "RenderAccel" "false" ??
I think the last 3 lines are optional. I have commented them out and it still works.
- In the "Screen" section, X probably set things up for 16- and 24-bit depth
configurations. I just use 24-bit depth, so I deleted the 16-bit "Display"
subsection. Then, to the 24-bit subsection, I added:
Modes "1024x768" "800x600" "640x480"
This is actually a simplification of the default setup. Since we're watching TV
on this box, we really ultimately need only one mode.
- Also add these lines to the "Screen" section (outside any "Device" subsection):
Option "TVStandard" "NTSC-M"
Option "ConnectedMonitor" "TV"
Option "TVOutFormat" "COMPOSITE"
Option "TVOverScan" "0.3"
You might want to play with the TVOverScan parameter to see if it gets the picture
bigger or smaller. Its range is 0.0 to 1.0, I think. I can't see that it has any effect at all.
|
Acquire and build MythTV
|
First you need to get some libraries and build and install them:
- lame
- libdvdread
- faad -
I had to change a few lines in the Makefile to start with a single tab instead
of spaces to get it to make. Also, you'll need to copy the file
common/mp4ff/mp4ff_int_types.h to /usr/local/include so Myth can compile.
- libcdaudio
- libid3tag
- libmad
- fftw
- mplayer
Next you need to get Mythtv. I am using v0.17, which I checked out from the CVS
repository. Here's how you do it:
setenv CVSROOT :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs
cvs login
(use mythtv as the password)
cvs checkout -r release-0-17 .
This gets all the various tools, such as MythMusic, MythDVD, etc. in addition to
MythTV.
After that cranks a while and finishes, you need to build it. I like to get all my
ducks in a row before starting, so I wrote a script to kick-start a few things.
You may want some different options, so the kick-start file is a good place to put
them so you will remember them. NOTE: You might need to configure
the sound card before doing any of this.
(cd mythtv; ./configure; qmake)
(cd mythbrowser; qmake)
(cd mythdvd; ./configure --enable-all; qmake)
(cd mythgallery; ./configure --enable-opengl; qmake)
(cd mythgame; qmake)
(cd mythmusic; ./configure --enable-all; qmake)
(cd mythnews; qmake)
(cd mythvideo; qmake)
(cd mythweather; qmake)
The build process seems to require that the mythtv directory be built and
installed before anything else can be built, so do that.
(cd mythtv; make all; sudo make install)
Now build the subdirectories:
(cd mythbrowser; make all; sudo make install)
(cd mythdvd; make all; sudo make install)
(cd mythgallery; make all; sudo make install)
(cd mythgame; make all; sudo make install)
(cd mythmusic; make all; sudo make install)
(cd mythnews; make all; sudo make install)
(cd mythvideo; make all; sudo make install)
(cd mythui; make all; sudo make install)
(cd mythweather; make all; sudo make install)
You may have to tell the OS where some shared libraries are. Edit the file
/etc/ld.so.conf and make sure it has a line reading "/usr/local/lib". If
you had to add that line, run "ldconfig" as root.
Looks like you need to install the init.d file manually. As root:
cp mythtv/contrib/etc.rc.d.init.d.mythbackend /etc/init.d/mythbackend
/sbin/chkconfig mythbackend on
| |
Initializing the database
|
MythTV makes use of mysql, so you need to make sure it's running and you have
a bare minimum of stuff in the database. As root:
/sbin/chkconfig mysqld on
mysql -u root <mythtv/database/mc.sql
If you get an error about "SQL Error" on the line reading "GRANT CREATE
TEMPORARY TABLES..." don't worry about it.
Next you'll need to run mythtv/setup/setup and set things up.
| |
How to make mythtv run at startup
|
We want this to act like an appliance, not a computer. So that means that
when it powers up, it should be accepting commands from your remote,
not asking for a login.
- Create a mythtv user, if you have not already. As root, do a
useradd -s /bin/tcsh mythtv
This will create the mythtv user and set its default
shell to tcsh. If you want to use a different shell, adapt instructions here
accordingly.
- If your Myth box is behind a proxy, you will want to add the line
setenv http_proxy http://yourproxy:3128
to the mythtv user's .cshrc file. The name of the proxy and the port number
may vary, depending on your proxy.
- Next we want to tell gdm to automatically log in, rather than ask for
a username/password. Edit the /etc/X11/gdm/gdm.conf file and change these
parameters to these values:
AutomaticLoginEnable=true
AutomaticLogin=mythtv
- There is some weirdness with Myth and Gnome (NOTE: It seems to be
working fine for me), so we need to make sure
myth runs under KDE. The easiest way to do this is to launch the Desktop
Switcher app and select KDE. It will instruct you to restart X; do it.
- Once the mythtv user is logged in, we want it to launch mythfrontend
automatically at login. To do this, we add a new file ~mythtv/.kde/Autostart/startmyth:
#!/bin/sh
/usr/local/bin/mythfrontend &
Also, make sure that file is executable:
chmod +x ~mythtv/.kde/Autostart/startmyth
- Also, go in to the Control Center and disable any screen savers that are on.
This is different from the X parameters we changed above, which do screen blanking
after a time.
| |
How to make the PVR-250 work
| |
Create a directory called, say, ivtv.
Then download ivtv into it.
Copy my Makefile and ivtv.rc files into that directory.
You might need to edit them to match your current version. The Makefile automatically gets firmware from Hauppauge's web site.
sudo make all install
chkconfig ivtv on
service ivtv start
NOTE: This may not work on a running system. ivtv allocates kernel memory which may not be available later on. So if this
fails, try a restart and that should work OK.
| |
Stuff you can turn off
|
You may want your Myth box to do some of these things, but my box is
a dedicated media center. For example, I'll never hook up a printer
to it or print from it, so I can turn off cups. Here is a list of
everything I turned off.
chkconfig isdn off; service isdn stop
chkconfig pcmcia off; service pcmcia stop
chkconfig mdmonitor off; service mdmonitor stop
chkconfig hpoj off; service hpoj stop
chkconfig sendmail off; service sendmail stop
chkconfig canna off; service canna stop
chkconfig cups off; service cups stop
chkconfig cups-config-daemon off; service cups-config-daemon stop
chkconfig iiim off; service iiim stop
| |
Setting up mythweb
|
Install mythweb into /var/www/html/myth:
mkdir /var/www/html/myth
cp -R /home/mythdev/stable/mythweb/* /var/www/html/myth
chown -R apache.apache /var/www/html/myth
Create file /etc/httpd/conf.d/myth.conf:
alias /myth /var/www/html/myth
<Directory /var/www/html/myth>
AllowOverride None
Options ExecCGI FollowSymLinks
Order allow,deny
Allow from all
</Directory>
Make sure the web server is running:
chkconfig httpd on
service httpd start
Now you can access mythweb at http://yourmythbox/myth.
|
Configuring the sound card
|
For some reason, MythTV does not default to using the ALSA sound system. So,
I had to edit the settings.pro file in the mythtv directory to uncomment the
following lines:
CONFIG += using_alsa
ALSA_LIBS = -lasound
I finally set up the digital sound on my SoundBlaster Live card. It was touchy
because I think I have an impedance mismatch in my cable or the connector I
soldered on to it, because it doesn't do anything unless I touch it ever so
slightly. Anybody know about SBLives being touchy about their digital sound
output cables?
Once I ran the cable from the machine to a digital audio input, I had to get
Myth to send out digital sound. You have to do this in two places:
- Playing TV and Recordings
In the General Setup options under Audio, I set the Audio Output Device to
ALSA:iec958
and the Mixer Device to
hw:0
I still haven't gotten Myth to control the volume yet though. alsamixer
seems to have very little effect on my digital audio sound.
- Watching Videos
The player application to watch videos also needs to be told to use the digital
audio. Under Media Settings->Player Settings, I had to add the following
options to mplayer:
-ao alsa:device=iec958
| |
Bluetooth keyboard
| |
I like to say I use a 101-key remote for my Myth box. I haven't done anything with
lirc yet, but maybe someday I will. Until then,
I use a standard Belkin USB-Bluetooth adapter and an Apple Wireless Keyboard.
FC3 is pretty much set up to do Bluetooth, so all you have to do is turn it on.
Make sure you have X running (runlevel 5) and do this:
chkconfig bluetooth on
chkconfig hidd on
service bluetooth start
service hidd start
Then, turn on your keyboard, and you will enter a protocol that makes you enter
a PIN. I'm really not sure how I got all this to work, but when I figure it out,
I'll write the rest of it down here.
| |
Installing it
| |
I picked up a couple items from Radio Shack to help all this along. First, I got
a
Video Amplifier. I'm always skeptical about these things, but this one works!
I crank the gain up all the way, because I've got splitters galore, and the PVR-250
really needs a strong signal. You might want to check out a
4-way Amplifier too. NOTE: Do not put this between your cable drop and the cable
modem. Radio Shack says you can, but my cable company tells me (and I believe them) that
they can cause problems. Just make sure your cable modem is hung off the very first
splitter after your cable drop and you'll be fine.
The second item I got is a video modulator that, I think, has been discontinued. It
takes the TV output of my nVidia card and broadcasts it on to the TV cable from channel 65
to 99. The concept is great, because it means I can locate my Myth box in the basement
(as long as it's underneath my living room so the Bluetooth is in range), and watch
the Myth output on some unused cable channel. It works in
theory but the power on the modulator is so weak that I get a fuzzy picture. So this
little gizmo's useful life will end after I run some wires (2 75-ohm coax cables for video
and digital audio). It's just as well, because that little thing won't do digital sound,
and once I get my HD tuner card I'll need it.
| |
| |
cvs checkout -r release-0-18 .
(cd mythtv; ./configure; qmake)
(cd mythtv/i18n; qmake)
(cd mythplugins; ./configure --enable-all; qmake)
(cd myththemes; qmake)
(cd mythtv; make all install) || exit
(cd mythplugins; make all) || exit
(cd myththemes; make all) || exit
|