====== Backend ======
===== Intro =====
Latest version is 12.04
Rebuild of the new machine with the dual tuner. The dual tuner card still hangs every few weeks. I think I'm going to tweak this a little so that it:
* Reboots daily
* Only does commercial flagging in the middle of the night
===== Install =====
==== Base ====
- Did an Update, but that apparently "wiped" the drive anyway...
* Chose the primary backend
* Enabled ALL services: SAMBA, NFS, SSH, Mythtv
- Update the packages to the latest and reboot
- Install some programs I cannot live without:
- jed: sudo apt-get install jed
==== Configuration ====
- Modify your network settings like this:
sudo nano /etc/network/interfaces
- set our IP address to what you want:
# The primary network interface
auto eth0
iface eth0 inet static
address xx.xx.xx.xx
netmask 255.255.255.0
network xx.xx.xx.xx # this one is the same as gateway I think
broadcast xx.xx.xx.255
gateway xx.xx.xx.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers xx.xx.xx.xx
dns-search some.domain.com
- Restart the networking:
sudo /etc/init.d/networking restart
==== HVR-2250 Drivers ====
I did a **grep** of **dmesg** looking for the 7164 card, and sure enough the support is there, but it can't find the firmware that the kernel was compiled with. I did a quick google and found the link to where the firmware file was. Here is what I did and how I installed the driver:
- Look in the log for what was missing:
[ 6.508493] saa7164_downloadfirmware() no first image
[ 6.508515] saa7164_downloadfirmware() Waiting for firmware upload (NXP7164-2010-03-10.1.fw)
[ 7.756686] saa7164_downloadfirmware() Upload failed. (file not found?)
- After doing a google search for that firmware, I found the link to here [[http://www.kernellabs.com/blog/?p=1443]], which led to a direct place to get the firmware:
cd ~/Downloads
wget http://www.steventoth.net/linux/hvr22xx/firmwares/4019072/NXP7164-2010-03-10.1.fw
- Copy this firmware into the Ubuntu folder:
sudo cp ~/Downloads/NXP7164-2010-03-10.1.fw /lib/firmware/
- Restart the module:
sudo rmmod saa7164
sudo modprobe saa7164
- And there was much rejoicing!
[ 1037.124209] Histogram named irq intervals (ms, count, last_update_jiffy)
[ 1037.124220] Total: 0
[ 1037.124224] Histogram named deferred intervals (ms, count, last_update_jiffy)
[ 1037.124230] Total: 0
[ 1037.124233] Histogram named irq to deferred intervals (ms, count, last_update_jiffy)
[ 1037.124239] Total: 0
[ 1037.124242] Histogram named encoder/vbi read() intervals (ms, count, last_update_jiffy)
[ 1037.124248] Total: 0
[ 1037.124252] Histogram named encoder/vbi poll() intervals (ms, count, last_update_jiffy)
[ 1037.124257] Total: 0
[ 1037.124261] Histogram named encoder/vbi read() intervals (ms, count, last_update_jiffy)
[ 1037.124267] Total: 0
[ 1037.124270] Histogram named encoder/vbi poll() intervals (ms, count, last_update_jiffy)
[ 1037.124276] Total: 0
[ 1037.124299] saa7164 0000:01:00.0: PCI INT A disabled
[ 1042.954006] saa7164 driver loaded
[ 1042.954176] saa7164 0000:01:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[ 1042.956572] CORE saa7164[0]: subsystem: 0070:8851, board: Hauppauge WinTV-HVR2250 [card=7,autodetected]
[ 1042.956586] saa7164[0]/0: found at 0000:01:00.0, rev: 129, irq: 16, latency: 0, mmio: 0xfd400000
[ 1042.956601] saa7164 0000:01:00.0: setting latency timer to 64
[ 1043.116024] saa7164_downloadfirmware() no first image
[ 1043.116041] saa7164_downloadfirmware() Waiting for firmware upload (NXP7164-2010-03-10.1.fw)
[ 1043.144214] saa7164_downloadfirmware() firmware read 4019072 bytes.
[ 1043.144222] saa7164_downloadfirmware() firmware loaded.
[ 1043.144226] Firmware file header part 1:
[ 1043.144235] .FirmwareSize = 0x0
[ 1043.144239] .BSLSize = 0x0
[ 1043.144243] .Reserved = 0x3d538
[ 1043.144247] .Version = 0x3
[ 1043.144251] saa7164_downloadfirmware() SecBootLoader.FileSize = 4019072
[ 1043.144263] saa7164_downloadfirmware() FirmwareSize = 0x1fd6
[ 1043.144268] saa7164_downloadfirmware() BSLSize = 0x0
[ 1043.144272] saa7164_downloadfirmware() Reserved = 0x0
[ 1043.144277] saa7164_downloadfirmware() Version = 0x1661c00
[ 1050.004040] saa7164_downloadimage() Image downloaded, booting...
[ 1050.108032] saa7164_downloadimage() Image booted successfully.
[ 1050.108063] starting firmware download(2)
[ 1052.232025] saa7164_downloadimage() Image downloaded, booting...
[ 1054.104036] saa7164_downloadimage() Image booted successfully.
[ 1054.104067] firmware download complete.
[ 1054.152527] tveeprom 14-0000: Hauppauge model 88061, rev C4F2, serial# 7079441
[ 1054.152537] tveeprom 14-0000: MAC address is 00:0d:fe:6c:06:11
[ 1054.152544] tveeprom 14-0000: tuner model is NXP 18271C2_716x (idx 152, type 4)
[ 1054.152552] tveeprom 14-0000: TV standards NTSC(M) ATSC/DVB Digital (eeprom 0x88)
[ 1054.152559] tveeprom 14-0000: audio processor is SAA7164 (idx 43)
[ 1054.152565] tveeprom 14-0000: decoder processor is SAA7164 (idx 40)
[ 1054.152571] tveeprom 14-0000: has radio, has IR receiver, has no IR transmitter
[ 1054.152577] saa7164[0]: Hauppauge eeprom: model=88061
[ 1054.515587] tda18271 15-0060: creating new instance
[ 1054.520221] TDA18271HD/C2 detected @ 15-0060
[ 1054.771027] DVB: registering new adapter (saa7164)
[ 1054.771042] DVB: registering adapter 0 frontend 0 (Samsung S5H1411 QAM/8VSB Frontend)...
[ 1055.066157] tda18271 16-0060: creating new instance
[ 1055.070573] TDA18271HD/C2 detected @ 16-0060
[ 1055.320827] tda18271: performing RF tracking filter calibration
[ 1057.669998] tda18271: RF tracking filter calibration complete
[ 1057.672579] DVB: registering new adapter (saa7164)
[ 1057.672593] DVB: registering adapter 1 frontend 0 (Samsung S5H1411 QAM/8VSB Frontend)...
[ 1057.673899] saa7164[0]: registered device video0 [mpeg]
[ 1057.904351] saa7164[0]: registered device video1 [mpeg]
[ 1058.115641] saa7164[0]: registered device vbi0 [vbi]
[ 1058.115759] saa7164[0]: registered device vbi1 [vbi]
==== Backend Configuration ====
Run Settings -> MythTV Backend Setup
* General
* [Page 1] IP Address to xx.xx.xx.xx
* [Page 1] Master backend IP address to same xx.xx.xx.xx
* [Page 8] Job Que: Start time 00:00 to Stop time 04:20 (Only flag commercials in the middle of the night)
* [Last Page] Automatically run mythfilldatabase
* Capture Cards
* New Capture Card -> DVB 0
* New Capture Care -> DVB 1
* Video Source
* New Video Source
* Video Source name: Local ATSC
* Username:
* Password:
* PRESS Retrieve lineups and pull up our zip code channels
* Input Connections
* Connect each tuner to the video source
* Scan for channels Once
* Set each to have a good default station, I'm using 67_1 for both
* Exit
* Run mythfilldatabase and that will take a while to get a fresh listing for 2 weeks
Now enable a few more things:
Run Settings -> Mythbuntu Control Centre
* MythExport
* Enable MythExport (so we can maybe export shows to iPod format for instance?)
* Plugins
* MythWeb
* Enable Password Protection
===== Tweaks =====
==== Filename Symbolic Links ====
So that the samba share is actually useful, I will make a cron job that will every day build a list of links to the recorded shows.
- Download the [[http://www.mythtv.org/wiki/Mythname.pl|mythname.pl]] script. I think I modified it, so just in case here is the version that runs on mythth now: {{:computers:server:mythname.pl.zip|}}
- Place that perl script in **/usr/local/bin**
- Make a directory / home for the symbolic links
sudo mkdir /var/lib/mythtv/recordings/links/
- Place the following script in **mythtv_cronjob_symlink_recordings**
#!/bin/sh
find /var/lib/mythtv/recordings/links/ -type l -exec rm {} \;
cd /var/lib/mythtv/recordings/links/
for filename in /var/lib/mythtv/recordings/*.mpg
do
# windows did not like the colons in the name, so changing to underscores and periods
fname=`/usr/local/bin/mythname.pl --rep=. --subtitle $filename | tr : _ | tr ';.' .`.mpg
##### no need to echo for a cron job ##### echo "Linking $filename to $fname"
ln -s $filename $fname > /dev/null 2>&1
done
exit 0
- Copy that file into **/etc/cron.daily/**
sudo cp mythtv_cronjob_symlink_recordings /etc/cron.daily/
- Set the ownership and permissions
sudo chown root:root /etc/cron.daily/mythtv_cronjob_symlink_recordings
sudo chmod 755 /etc/cron.daily/mythtv_cronjob_symlink_recordings
- I added these lines to **/etc/samba/smbd.conf** trying to get the links to work
follow symlinks = yes
unix extensions = no
wide links = yes
==== Backend Card Hang / Crash ====
Use an hourly cron job to check for this error. If you see it, reboot! Here is my **cron.hourly** script **mythtv_check_for_crashed_tuner**:
#!/bin/bash
#
SAA7164ERRORS=$(/bin/dmesg | /bin/grep saa7164_api_i2c_write | /usr/bin/wc -l)
if [ $SAA7164ERRORS -ne 0 ]; then
MYDATE=$(/bin/date)
echo $MYDATE : Rebooting Now Due to saa7164 card crash >> /home/mythbot/mythbot_reboot_log.txt
/sbin/reboot
fi
====== Frontend ======
===== Basics =====
- Installed Mythbuntu from CD making this computer just a "front end"
- Enabled SSH
- Left DHCP as I have my daemon giving out the proper IP based on MAC address
===== Configuration =====
- Modified theme to the one I LIKE!
- Modified ALSA mixer so that audio SPDIF is output
- Load up the mixer as root
sudo alsamixer
- Modify the line: **Item: S/PDIF Output [Off]** with the 'M' key
- Save your configuration with:
sudo alsactl store 0
- Modified the Audio output to use S/PDIF:
- Utilities / Setup -> Setup -> General -> Page 4 **NOTE** Anything but default / stereo breaks the SPDIF output... don't touch this
- Did set the audio outputs to 100% on both Master and PCM
- Speaker Configuration from **Stereo** to **5.1** NOTE: This seems to BREAK my audio now?! If I leave it stereo it works.
- Upmix: **Best**
- Audio Processing Capabilities: Check both **Dolby Digital** AND **DTS**
- Set our VIDEO output to VDPAU:
- Utilities / Setup -> TV Settings -> Playback -> Page 3/8
- Current Video Playback Profile:VDPAU High Quality
==== Remote Control Configuration ====
I added the following lines to my **lirc** configuration: **~/.lirc/mythtv**
### added by david rabine (dlr) 2009.12.28 ###
# I added the following - dlr 2008/10/18
# Skip forward (10 min default)
begin
remote = Streamzap_PC_Remote
prog = mythtv
button = >>
repeat = 0
config = PgDown
delay = 0
end
begin
remote = Streamzap_PC_Remote
prog = mythtv
button = <<
repeat = 0
config = PgUp
delay = 0
end
# Seek to previous commercial cut point
begin
remote = Streamzap_PC_Remote
prog = mythtv
button = YELLOW
repeat = 0
config = Q
end
# Seek to next commercial cut point
begin
remote = Streamzap_PC_Remote
prog = mythtv
button = BLUE
repeat = 0
config = Z
end
==== Media Library ====
=== Audio ===
- Add in symbolic links to our libraries
- Go to Listen to Music and it will scan for new files
=== Video ===
- Add in symbolic links for all our shares / files
- Go to Utilities / Setup -> Setup -> Media Settings -> Video Settings -> General Settings: /var/lib/mythtv/video as Directories that hold videos
==== Media Types ====
=== mkv ===
I was having some issues with the internal player not hanging very well with high definition content, so I modified the video player setup to use **mplayer**
- Surf in the mythtv setup to this menu structure: Utilities / Setup -> Setup -> Media Settings -> Video Settings -> File Types
- Change the extension to "mkv"
- Enter the following command into the **Command:** line
mplayer -cache=16384 -cache-min=10 -fs -zoom -quiet -nosub -vo vdpau -vc ffh264vdpau -heartbeat-cmd "xscreensaver-command -deactivate" %s
* the **-vc** call makes a huge difference in CPU usage (from 50% to 2% doing a 1080p video) (I thought the **-vo** would do it on its own but it does not)
* the **-heartbeat-cmd "xscreensaver-command -deactivate"** keeps the screen from blanking every 10 minutes or so
===== Trouble Shooting =====
- The images were "tearing" with some High Definition content, found [[http://www.mythtv.org/wiki/VDPAU]] this page. Not sure why disabling the composite output on the card fixes this, but it does.
sudo nvidia-xconfig --no-composite