MythTV Installation on a Silverstonetek

In september 2005 I received an old pc from my mom. The machine was a Pentium III 733 MHz with two 20 Gb harddisks in it and 256 Mb ram.

During that period Windows Media Center Edition started becoming popular in The Netherlands. Complete multi media pc's with video recording capabilities were being sold for over 1000 Euros.

A personal video recorder sounded quite useful to me. Our VHS tape recorder still works, but is not very intelligent, has poor video quality and can only record up to 4 hours on 1 tape in the best quality. But spending over 1000 Euro's on a new Windows PC wasn't very appealing.

Looking for alternatives I ran into MythTv and since I had some old hardware laying around I decided to try installing MythTv on it. The main reasons for doing this were:

  • The fun of creating your own PVR
  • Make use of free software
  • Try creating a PVR as cheap as possible to my own likings

And reading through the MythTv documentation this was the right software to try to achieve my goals.

First installation

For my first installation I was very happy that many people on the internet mentioned Jarod Wilsons Fedora MythTv howto. I did have some experience with RedHat and Fedora and reading through Jarod's manual I thought I should be able to get things to work.

My first hardware list:

  • Intel Pentium III 733 MHz
  • Two 20 Gb Harddisks
  • 256 Mb Ram
  • On board sound card
  • Cinergy TV 400 TV Tuner, with IR eye and remote control

The TV Tuner card has a Philips saa7134 chipset. So it is not an hardware MPEG-2 encoder card and not a Brooktree bt878 compatible chipset card. This tuner card was my main concern.

Cinergy TV 400 Tuner card under Linux

Reading and trying a lot with the Cinergy 400 tuner card resulted in the following conclusion:

The card can be used in two modes:

  • With internal sound enabled
  • Without internal sound enabled

The card has no hardware encoding, so your processor will need to do a lot of work, and recording video will cost a lot of diskspace, so you will need to transcode to e.g. divx afterwards if disk space is a problem.

With internal sound enabled you don't need to connect the video card to your sound card to record sound. The advantage is that the sound will always be in sync with your video. The disadvantage under linux is that switching channels creates an incredible loud noise/hiss which can damage your speakers if played too loud. A program like TVTime works around this issue by fading in the sound when switching channels. For MythTv I wasn't able to get this same behaviour without changing the source code. There are scripts that can be used to simulate the fading in, but I couldn't get them to work with my setup.

Withouth the internal sound enabled you need an audio cable to connect the decoded audio from the tuner card into your sound card. MythTv will use the sound card to record audio. This is a good supported feature in MythTv and I didn't have any audio sync problems trying this. The only thing you have to ensure is that the audio settings are correct for audio card (and that they are the same after a reboot ;), this is described nicely in Jarod Wilsons howto. One thing I couldn't get to work nicely is watching LiveTV in MythtTv, there is a 'sound loop' which makes the sound output horrible after a few seconds. This could be caused by the used hardware or my audio card settings.

Althogether I would advise you to use this video card only if you have no other choice. After reading the mythtv mailing lists for more htan half a year I would buy a Hauppage mpeg-2 encoder card with 2 encoder cards. Why? Because they do good hardware encoding, you can record 2 shows simultaniously, no sound issues, no processor load, less hard disk space needed, export to dvd is possible without transcoding.

So now the settings you will need:

With internal audio enabled:

modprobe.conf contains:

alias char-major-81 saa7134
saa7134 card=8 oss=1 tuner=5 mixer_nr=3 dsp_nr=3

Which occupies /dev/dsp3 and /dev/mixer3 for the audiochip, these can be used in the MythTv configuration setup.

modprobe.conf contains:

alias char-major-81 saa7134
options saa7134 card=8 oss=0 tuner=5

The tuner=5 option is needed to get the tuner to work as PAL The oss=0 is needed to enable the internal sound decoder

More information about the tuner card can be found here: http://gentoo-wiki.com/HARDWARE_saa7134#Audio_Settings

A tip: before you try to see if your tuner card works in MythTv I suggest to try if it works with TvTime. TvTime had an automatic channels scan that worked with my tuner card and during the scan I already saw some channels were working. http://tvtime.sourceforge.net/

Getting the channels to work in MythTv

Once I knew that my tuner card was working under Linux and showed channels in TvTime I had to get the channels working in MythTv. The problem was that I live in The Netherlands and here we have some really region specific channel frequencies. Using TvTime I could get one or two channels to work but some didn't work at all. Most of my time in setting up MythTv has been spend on this problem. I did knew the frequency in Mhz of all my TV channels but entering frequencies (in Hz) in MythTv didn't result in a signal. Although this should work according to people on the mailing list I did end up writing a frequency to channel convertor which tells you which Channel id to use (e.g. S4) and the finetune value (e.g. 16).

The best way to change enter all channel settings the first time was via MythWeb. Although one thin I missed was the option to add additional channels. Via mythtvsetup you can add channels but via MythWeb you can only edit and delete, but you can edit multiple channels at once, which is very convenient. Future MythWeb versions will probably solve this.

Click here for my frequence 2 channel convertor.

Time for a Silverstonetek

Once I had MythTv up and running I decided that I liked it and that I had to replace the VCR in the living room with a machine running MythTV. But there were some issues of course ;)

The big problems with the test machine:

  • It is very loud
  • It has an ugly casing
  • There is no nice infra red integration

So I decided that the first thing to do was to find a really nice casing for in our living room. One that could be allways in sight.

TODO

Configuring MythTv

In this chapter you will found some steps I took to get MythTv working as desired.

Setting up paths

To be able to compile Lirc I had to add some paths to my configuration.

Change .bash_profile to:

[mythtv@mythtvtest ~]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
      . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/sbin

export PATH
unset USERNAME

Log out and log in again to see the changes.

Automatic shutdown

What I use now is:

30 02 * * * /sbin/shutdown -h 0 »/dev/null 2>&1

Machine shuts down at night and doesn't do a reboot, but a halt (-h)

I would like the machine to start and stop automatically. This must be possible with my motherboard but I haven't tried yet. I'm also waiting since I'm not yet using MythTv 0.19 which has a special page implemented so the mythfrontend is not running when you're not using mythtv and this enables automatic shutdown easier (if I understand it correctly).

Information about automatic wake up can be found here: http://www.mythtv.org/wiki/index.php/ACPI_Wakeup

LCD imon vfd driver

If you are only interested in the lcd display of the Silverstone case you can compile Venky's lcd driver http://venky.ws/projects/imon/ and I was able to run it as follows:

As root [root@mythtvtest lcdproc-0.4.5-imon]# modprobe imon_vfd [root@mythtvtest lcdproc-0.4.5-imon]# ./server/LCDd -c LCDd.conf [root@mythtvtest lcdproc-0.4.5-imon]# lcdproc T

LCD and lirc imon driver

Read here how I got the vfd lcd display and the IR receiver to work.

How to show all loaded modules?

use lsmod

How to test if usb is working?

Testing if usb is working correctly:

[root@mythtvtest mythtv]# yum install usbview

Followed by running usbview

How to check if the Cinergy 400 remote control is working

Install the IR receiver supplied with the tuner card. The remote control is registered as usb keyboard. From the internet I got the following information:

Use the “xev” program to see if X can see remote button presses. If you use the “Multimedia Keys” settings in GNOME (and presumably something similar in KDE), you can assign arbitrary keys (including those buttons on the remote) to various desktop functions such as volume/mute control. (Use of xev(1) shows that not all the buttons on the remote are supported - while most generate events, the buttons labelled “CATV”, “Video”, “Audio”, “Full Screen”, and channel up and down don't appear to be visible for some reason).

Imon pad not working with correct IR codes

My Imon Pad http://www.soundgraph.com/img/pad.gif remote control batteries were empty.

After inserting new batteries I pushed a combination of buttons to see if the infra red control was working. (The remote control has a led indicator)

I started my MythTv machine and the remote didn't work anymore, only some of the 'mouse pad' signals were coming through.

Looking with lirc's mode2 to debug I saw that every button did send it's signals but the codes had changed. Did I reprograam the remote control to act as a different one (like you can with 'univerasal remotes') or did something else go wrong??? I tried other batteries but the problem remained.

My solution was: remove the batteries, push the red Power button for 5 seconds while you insert the batteries again.

The following questions remained: - is the remote control actually 'programmable' - if so did I find the correct solution or was it all an 'exident'

I did mail soundgraph.com (the manufacturer of the remote control) and this was their response:

Dear Martijn,

There 's no way to configure iMON PAD remote for other device. 
The abnormal IR signal generation may come from restart failure 
of remote controller when inserting new batteries. Please get away 
batteries and re-insert them to remote.

Best regards,

iMON@soundgraph.com

Installing GOPChop

Fedora Core 4 GOPChop can be installed via rpm: ftp://rpmfind.net/linux/sourceforge/g/go/gopchop/gopchop-1.1.3-1.i386.rpm

It installs right away, but it is not the latest version. The latest version can be found at http://gopchop.sourceforge.net/

Installing NuvExport

http://forevermore.net/files/nuvexport/nuvexport-0.2-0.20051118.svn.noarch.rpm

Download and install rpm.

but it depends on

yum install id3lib
yum install avidemux2
yum install divx4linux
lve (linux video editor) via rpm: [[http://rpmforge.net/user/packages/lve/]]

Fedora Core 2 for i386 (fc2-i386) lve-0.040322-1.1.fc2.dries.i386.rpm (dries) Seems to install on Fedora Core 4

Trying again to install the nuvexport rpm now succeeds, the installer asks for fedora disc 1 to install perl-time-hires module and after that nuvexport is installed.

How to get the free space on the hard disc info

[mythtv@mythtvtest ~]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda2              12G  4.2G  6.7G  39% /
/dev/hda1              99M   13M   82M  14% /boot
/dev/shm              126M     0  126M   0% /dev/shm
/dev/hda5             174G  8.5G  166G   5% /video

How to read the cpu temperature and fan speeds?

To get this information lm_sensors is needed. This is already part of Fedora Core 4

First you need to run

usr/sbin/sensors

I needed to adapt 2 lines in the script /usr/sbin/sensors to use /usr/sbin/i2detect since i2detect was not on my path, I needed to figure out how to add sbin to my path since I had also troubles compiling imon_vfd display driver where the makefile uses /sbin/depmod but depmod was not found. See this page for the solution.

Running the script shows in the end what you have to paste into modprobe.conf and rc.local, this is quite important

I had to add the following to modprobe.conf

#i2c line for lm_sensors and sensors (CPU Temperature, fan speeds etc.)
alias char-major-89 i2c-dev

And to /etc/rc.local I added

# I2C adapter drivers
# modprobe unknown adapter saa7134[0]
modprobe i2c-viapro
modprobe i2c-isa
# I2C chip drivers
modprobe eeprom
modprobe w83627hf
# sleep 2 # optional
/usr/bin/sensors -s # recommended
#----cut here----

Since i do not know how to reload rc.local and modprobe.conf I rebooted. Running /usr/bin/sensors now showed the following:

[mythtv@mythtvtest ~]$ /usr/bin/sensors
w83697hf-isa-0290
Adapter: ISA adapter
VCore:     +1.65 V  (min =  +1.71 V, max =  +1.89 V)       ALARM
+3.3V:     +3.25 V  (min =  +3.14 V, max =  +3.47 V)       ALARM
+5V:       +5.00 V  (min =  +4.76 V, max =  +5.24 V)
+12V:     +11.92 V  (min = +10.82 V, max = +13.19 V)       ALARM
-12V:     -11.95 V  (min = -13.18 V, max = -10.80 V)       ALARM
-5V:       -5.15 V  (min =  -5.25 V, max =  -4.75 V)       ALARM
V5SB:      +5.38 V  (min =  +4.76 V, max =  +5.24 V)       ALARM
VBat:      +3.34 V  (min =  +2.40 V, max =  +3.60 V)       ALARM
fan1:     1985 RPM  (min =   -1 RPM, div = 4)              ALARM
fan2:     1917 RPM  (min = 2636 RPM, div = 4)              ALARM
temp1:       +25°C  (high =    +1°C, hyst =    +0°C)   sensor = thermistor   ALA                                           RM
temp2:     +35.0°C  (high =   +70°C, hyst =   +67°C)   sensor = thermistor                                                
alarms:
beep_enable:
          Sound alarm enabled

eeprom-i2c-1-50
Adapter: SMBus Via Pro adapter at 0400
Memory type:            DDR SDRAM DIMM
Memory size (MB):       256 

eeprom-i2c-0-50
Adapter: saa7134[0]
Unknown EEPROM type (66)

Philips PAL_BG -i2c-0-60
Adapter: saa7134[0]

Temp1 is my case temperature ,temp2 is my processor temp

rc.local

My current rc.local file:

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
 
touch /var/lock/subsys/local
 
# I2C adapter drivers
modprobe i2c-viapro
# modprobe unknown adapter saa7134[0]
modprobe i2c-isa
# I2C chip drivers
modprobe eeprom
modprobe w83627hf
# sleep 2 # optional
/usr/bin/sensors -s # recommended
 
# lirc and LCDd stuff
modprobe lirc_imon
/etc/init.d/lirc start
/etc/init.d/LCDd start
 
# enable sound for tv tuner
/usr/bin/v4lctl volume mute off
 
# If we can see our router, there is probably internet
# so we should be able to update mythfilldatabase
if [ `ping 10.0.0.2 -c 1 |grep -c "1 received"` -ge 1 ]
  then
  # Sync machine time with dutch ntp time server
  echo RUNNING time sync
  ntpdate nl.pool.ntp.org &
fi

myth-load.sh

My current myth-load.sh:

#!/bin/bash
 
# Only do this stuff if we're on the main display
# (i.e., don't do this in a vnc session)
if [ `echo $DISPLAY | grep -c ":0"` -ge 1 ]
then
    # Load nVidia driver custom settings
    #nvidia-settings --load-config-only &
 
    # Restore audio settings
    /usr/sbin/alsactl restore
 
    # Launch irexec for myth power button stop/start
    #irexec &
 
    # Launch myth frontend
    mythfrontend &
 
    # Disable dynamic power management (screen blanking)
    /usr/X11R6/bin/xset -dpms
    # Disable screen saver
    /usr/X11R6/bin/xset s off
 
    # If we can see our router, there is probably internet
    # so we should be able to update mythfilldatabase
    if [ `ping 10.0.0.2 -c 1 |grep -c "1 received"` -ge 1 ]
    then
        # Run mythfilldatabase
        echo RUNNING mythfilldatabase
        mythfilldatabase &
 
        # Sync machine time with dutch ntp time server
        #echo RUNNING time sync
        #ntpdate nl.pool.ntp.org &
    fi
fi
exit
mythtv/installation.txt · Last modified: 2012/04/14 15:13 (external edit)
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki