MythTV

From JasonAntmanWiki
Jump to: navigation, search

MythTV is a Linux-based PVR (Personal Video Recorder) for your computer. It allows you to watch (and pause, replay, etc.) live TV, record programs, and manage and playback your multimedia library. It will run on any computer running Linux (x86 recommended). It requires a backend (to handle recording, administration, etc.) program and a frontend to view the video, as well as a web server, PHP, and MySQL. I have everything running on one computer with a Haupphauge PVR-150 video tuner card and a 21" CRT monitor.

Contents

Remote Control

MythTV can be used with the lirc Linux IR driver to both receive and send IR remote control signals. The PVR-150 comes with a remote control and builtin IR receiver and "IR blaster" to control a connected device (TV, VCR, DVD player, cable box, etc).

In my personal setup, I have the Haupphauge remote control to control the MythTV box, and the IR blaster setup to control my Cablevision (Scientific Atlanta Explorer 4200) set-top tuner box.

The control of the external cable box was relatively straightforward following the information on the MythTV site. The one thing to be wary of, though, is that the SuSE LIRC RPM is flawed, and will not work with the Haupphauge IR Blaster. A little googling turned up a site that provided specific information on using the PVR-150 with SuSE. I have lost the site, but the bottom line is that you have to compile LIRC from source manually, and be sure to include support for the PVR-150 and i2c.

I haven't yet put the i2c module in the system init scripts, so be sure to [code]modprobe lirc-i2c[/code].

One thing to watch - since you have installed LIRC from source and *not* RPM, when you try and upgrade MythTV via RPM, you'll get a failed dependency for some LIRC library. You can just [code]rpm -Uvh --nodeps[/code] (as long as this is the only error you're getting) and not worry about it, since it's actually there. And be sure that you upgrade LIRC as needed.

Getting the irblaster output working was relatively easy. Getting the Haupphauge remote to control MythTV, on the other hand, was not. I found a great tutorial (intended for Gentoo, but perfectly applicable) here. Once I got everything setup using [code]irw[/code], I began work on getting the remote to control MythTV. I followed the Gentoo article, and decided that the easiest way was to use irxevent and setup my .lircrc to control everything using that facility. First, as the user running mythfrontend, test everything using [code]irxevent &[/code]. Assuming you have correctly setup .lircrc, it will now control MythTV. Once you get it all correct, you can add that command to your .xinitrc file. To test, I just setup my .lircrc the way I wanted and then tried all of the buttons that I setup. The sample file that I found on the Gentoo Wiki page was a bit different from the default MythTV keybindings, so I encourage you to look at the MythTV Keyboard Commands page and setup your file as you wish.

Schedule Data

Zap2It Labs shut down their free DataDirect service in September, 2007. There was a week or so where there was no other option, but some of the major players in F/OSS DVR's have pulled through by creating SchedulesDirect which provides a drop-in replacement, as long as you update a few packages in MythTV. It's not free - they have to license the schedule data, and that cost is passed on to the customer. As of October 22, 2007, the price is $20/year. I was in literally the first group to join, in the first few hours of operation. At that point the price was much higher. They have been very good in keeping with their promise to drop the price as membership increases, and have also been very good about extending current members' subscriptions to jive with the updated price.

External Cable Box

While changing the channels from MythTV isn't that hard, the main thing I had to cope with was the power state of the cable box. Obviously, if the box is turned off, channel change commands won't do much. There are, essentially, two options:

  • Implement control of the cable box from a "handler" program, which reads a specific lockfile. If the file exists, the box is on. If it doesn't exist, a power on command is sent first, and the lockfile is created.
  • Just always leave the box on.

I went with the easiest, and decided to always leave the power on.

I followed the MythTV instructions and found an appropriate channel changer in the contrib folder. This was located, on my system, at [code]/usr/share/doc/packages/mythtv/contrib/channel_changers[/code]. I chose the change-channel-lirc.pl file. I copied this to /usr/local/bin/changechannel, as per the instructions on the MythTV site. Now, in [code]mythtv-setup[/code] -> Input Connections -> Tuner 1, I just entered [code]/usr/local/bin/changechannel[/code] in the External channel change command. To cope with my cable box's output, I entered "3" for "Preset tuner to channel". Now, I have a fully-functional system with which I can control the cable box's channels from MythTV. The only issue with this is that the irsend facility (used by the lirc channel change script) has considerable delay. My Scientific Atlanta Explorer 4200 set-top box already has a lag of 3 seconds or so when changing channels. All told, this adds up to a lag of approximately 5 seconds when changing channels, which makes channel surfing nearly impossible.

Cable Box OSD

One other issue that I have is as follows: My Cablevision (iO) cable box presents an on-screen display bar at the bottom of the screen showing the channel logo, title, and information. This happens to be pretty much at the same place on the screen as MythTV's bar. This presents two problems - first, it will appear at the beginning of any recordings and second, it's annoying to have two supers on the same place on the screen. When I get a chance, I'll look into disabling one of them.

Moving

When I left the Rutgers dorms at the end of 2007, I brought my MythTV box home. After about 12 hours trying to get the box to jive with the new channel lineup, I ended up messing it up beyond repair. When I moved into my new apartment off-campus, I found it impossible to get MythTV to do anything useful - not to mention that I now also had to figure out how to get it to tune the channels externally and also deal with the power state of the cable box.

Add-Ons

I've added few addons to MythTV, but Mythweb is definitely the best. It allows me to view the guide, list of recorded programs, schedule recordings, etc. via a web interface from another computer on the LAN. Eventually, I'd like to move it up to an HTTPS server and have it accessible remotely, so that I could add/remove scheduled recordings from offsite.

Keyboard Commands

A list of a few of the keyboard commands that I've found helpful:

LiveTV

  • H -> move back in history of channels

LiveTV Recordings

In Media Library -> Watch Recordings:

  • to view all LiveTV recordings in the list, press "M", select "Change Group Filter", and select LiveTV.
  • to keep a LiveTV recording, highlight it, press "i", select "Storage Options", and select "Disable Auto Expire"

Future Work

  • figure out the dual OSD issue
  • get a card with TV-out and watch TV on something bigger than a 21" CRT
  • mythweb via HTTPS - schedule recordings from the road

External Links

My Sample Files

.lircrc

This file should be in the home directory of the user running mythfrontend.

# ~/.mythtv/lircrc
#
# MythTV native LIRC config file for
# the new grey Hauppauge remote
#
# Modified from Jarod Wilson's which came from Jeff Campbell's
# By Brad Templeton

# Time-stamp: " "
# Jason Antman
# http://www.jasonantman.com (look for more info in the Wiki)
# modified for TITAN

# 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

# try power button to start mythfrontend
begin
	button = Power
	prog = irexec
	repeat = 0
	config = mythfrontend
end

begin
    prog = irxevent
    button = OK
    repeat = 3
    config = Key Return CurrentWindow
end
begin
    prog = irxevent
    button = CH+
    repeat = 3
    config = Key Up CurrentWindow
end
begin
    prog = irxevent
    button = CH-
    repeat = 3
    config = Key Down CurrentWindow
end
begin
    prog = irxevent
    button = Menu/i
    repeat = 3
    config = Key u CurrentWindow
end
begin
    prog = irxevent
    button = RECORD
    repeat = 3
    config = Key R CurrentWindow
end
begin
    prog = irxevent
    button = VOL-
    repeat = 3
    config = Key F10 CurrentWindow
end
begin
    prog = irxevent
    button = REV
    repeat = 3
    config = Key Left CurrentWindow
end
begin
    prog = irxevent
    button = PLAY
    repeat = 3
    config = Key P CurrentWindow
end
begin
    prog = irxevent
    button = MUTE
    repeat = 3
    config = Key F9 CurrentWindow
end
begin
    prog = irxevent
    button = VOL+
    repeat = 3
    config = Key F11 CurrentWindow
end
begin
    prog = irxevent
    button = FFW
    repeat = 3
    config = Key Right CurrentWindow
end
begin
    prog = irxevent
    button = BACK/EXIT
    repeat = 3
    config = Key Escape CurrentWindow
end
begin
    prog = irxevent
    button = PAUSE
    repeat = 3
    config = Key P CurrentWindow
end
#start new stuff
begin
	prog = irxevent
	button = Guide
	repeat = 3
	config = Key M CurrentWindow
end
begin
	prog = irxevent
	button = RED
	repeat = 3
	config = Key backslash CurrentWindow
end
begin
	prog = irxevent
	button = GREEN
	repeat = 3
	config = Key question CurrentWindow
end
begin
	prog = irxevent
	button = Prev.Ch
	repeat = 3
	config = Key H CurrentWindow
end
begin
	prog = irxevent
	button = Left
	repeat = 3
	config = Key Left CurrentWindow
end
begin
	prog = irxevent
	button = Right
	repeat = 3
	config = Key Right CurrentWindow
end
begin
	prog = irxevent
	button = Up
	repeat = 3
	config = Key Up CurrentWindow
end
begin
	prog = irxevent
	button = Down
	repeat = 3
	config = Key Down CurrentWindow
end
#end new stuff
begin
    prog = irxevent
    button = 0
    config = Key 0 CurrentWindow
end
begin
    prog = irxevent
    button = 1
    config = Key 1 CurrentWindow
end
begin
    prog = irxevent
    button = 2
    config = Key 2 CurrentWindow
end
begin
    prog = irxevent
    button = 3
    config = Key 3 CurrentWindow
end
begin
    prog = irxevent
    button = 4
    config = Key 4 CurrentWindow
end
begin
    prog = irxevent
    button = 5
    config = Key 5 CurrentWindow
end
begin
    prog = irxevent
    button = 6
    config = Key 6 CurrentWindow
end
begin
    prog = irxevent
    button = 7
    config = Key 7 CurrentWindow
end
begin
    prog = irxevent
    button = 8
    config = Key 8 CurrentWindow
end
begin
    prog = irxevent
    button = 9
    config = Key 9 CurrentWindow
end


This file breaks down as follows:

TITAN jantman .lircrc Key Usage

TO START mythfrontend
   Power (should start mythfrontend if it's not running)

IN MYTHFRONTEND:

Button	      Key Binding	Function
OK	      Return		OK/Return
CH+	      Up		Chan Up
CH-	      Down		Chan Down
MENU	      u			More Info (EPG)
RECORD	      R			Toggle Record
RED	      backslash		Toggle view favotires/all (EPG)
GREEN	      question		Toggle Favorite
VOL-	      F10		Vol Down
VOL+	      F11		Vol Up
REV	      Left		Rewind
PLAY	      P			Play/Pause
MUTE	      F9		Mute
FFW	      Right		Fast Forward
BACK/EXIT     Escape		Escape
PAUSE	      P			Pause/Play
Guide	      M			Show Guide / OSD
Prev.Ch	      H			Previous Channel / History
Left	      Left		Left Arrow
Right	      Right		Right Arrow
Up	      Up		Up Arrow
Down	      Down		Down Arrow
0 (to 9)      0 (to 9)


**Please note - I opted to keep the remote commands as close to the keyboard as possible.
Therefore, after entering a channel number, you must press "OK" to tune to it.

/etc/lircd.conf


#
# this config file was automatically generated
# using lirc-0.5.5pre8 on Sun Apr 18 11:43:45 1999
#
# contributed by Jens Leuschner <leuschner@gmx.net>
#
# brand:             Hauppauge
# model:             
# supported devices: WinTV primo; WinTV pci; WinTV radio
#
# This config file will work with both homebrew receivers and 
# original Hauppauge TV cards !!!
#

begin remote

  name          blaster
  bits          32
  flags         RAW_CODES
  eps           0
  aeps          0
  plead         0
  gap           333333
  repeat_bit    0
  begin raw_codes
    name 0_75_KEY_0
    4915200
    name 0_75_KEY_1
    4915201
    name 0_75_KEY_2
    4915202
    name 0_75_KEY_3
    4915203
    name 0_75_KEY_4
    4915204
    name 0_75_KEY_5
    4915205
    name 0_75_KEY_6
    4915206
    name 0_75_KEY_7
    4915207
    name 0_75_KEY_8
    4915208
    name 0_75_KEY_9
    4915209
    name 0_75_KEY_POWER
    4915210
    name 0_75_KEY_CH_UP
    4915215
    name 0_75_KEY_CH_DOWN
    4915216
    name 0_75_KEY_MUTE
    4915217
    name 0_75_KEY_VOL_DOWN
    4915218
    name 0_75_KEY_VOL_UP
    4915220
    name 0_75_KEY_MUP
    4915248
    name 0_75_KEY_MDOWN
    4915249
    name 0_75_KEY_MLEFT
    4915250
    name 0_75_KEY_MRIGHT
    4915251
  end raw_codes
end remote

begin remote

  name  Hauppauge
  bits           13
  flags SHIFT_ENC
  eps            30
  aeps          100

  one           950   830
  zero          950   830
  plead         960
  gap          89584
  repeat_bit      2

      begin codes
          TV                       0x000000000000100F
          RADIO                    0x000000000000100C
          FULL_SCREEN              0x000000000000102E
          CH+                      0x0000000000001020
          CH-                      0x0000000000001021
          VOL-                     0x0000000000001011
          VOL+                     0x0000000000001010
          MUTE                     0x000000000000100D
          SOURCE                   0x0000000000001022
          1                        0x0000000000001001
          2                        0x0000000000001002
          3                        0x0000000000001003
          4                        0x0000000000001004
          5                        0x0000000000001005
          6                        0x0000000000001006
          7                        0x0000000000001007
          8                        0x0000000000001008
          9                        0x0000000000001009
          0                        0x0000000000001000
          RESERVED                 0x000000000000101E
          MINIMIZE                 0x0000000000001026
      end codes

end remote


#
# this config file was automatically generated
# using lirc-0.6.6(animax) on Tue Apr 15 19:50:27 2003
#
# contributed by 
#
# brand: 				Hauppauge
# model no. of remote control: 
# devices being controlled by this remote: PVR 2/350
#

begin remote

  name  hauppauge_pvr
  bits           13
  flags RC5|CONST_LENGTH
  eps            30
  aeps          100

  one           969   811
  zero          969   811
  plead        1097
  gap          114605
  toggle_bit      2


      begin codes
          Power                    0x00000000000017FD
          Go                       0x00000000000017FB
          1                        0x00000000000017C1
          2                        0x00000000000017C2
          3                        0x00000000000017C3
          4                        0x00000000000017C4
          5                        0x00000000000017C5
          6                        0x00000000000017C6
          7                        0x00000000000017C7
          8                        0x00000000000017C8
          9                        0x00000000000017C9
          Back/Exit                0x00000000000017DF
          0                        0x00000000000017C0
          Menu                     0x00000000000017CD
          Red                      0x00000000000017CB
          Green                    0x00000000000017EE
          Yellow                   0x00000000000017F8
          Blue                     0x00000000000017E9
          Ch+                      0x00000000000017E0
          Ch-                      0x00000000000017E1
          Vol-                     0x00000000000017D1
          Vol+                     0x00000000000017D0
          Ok                       0x00000000000017E5
          Mute                     0x00000000000017CF
          Blank                    0x00000000000017CC
          Full                     0x00000000000017FC
          Rewind                   0x00000000000017F2
          Play                     0x00000000000017F5
          Forward                  0x00000000000017F4
          Record                   0x00000000000017F7
          Stop                     0x00000000000017F6
          Pause                    0x00000000000017F0
          Replay                   0x00000000000017E4
          Skip                     0x00000000000017DE
      end codes

end remote


#
# this config file was automatically generated
# using lirc-0.7.0(any) on Sun Nov 28 20:25:09 2004
#
# contributed by 
#
# brand:   Hauppauge 350
# Created: G.J. Werler (The Netherlands)
# Project: Mythtv Fedora Pundit-R www.mythtvportal.com
# Date:    2004/11/28
# model no. of remote control: Hauppauge A415-HPG
# devices being controlled by this remote: PVR-350
#

begin remote

  name  Hauppauge_350
  bits           13
  flags RC5|CONST_LENGTH
  eps            30
  aeps          100

  one           969   811
  zero          969   811
  plead        1097
  gap          114605
#  gap		200000
  toggle_bit      2


      begin codes
          Go                       0x00000000000017BB
          Power                    0x00000000000017BD
          TV                       0x000000000000179C
          Videos                   0x0000000000001798
          Music                    0x0000000000001799
          Pictures                 0x000000000000179A
          Guide                    0x000000000000179B
          Radio                    0x000000000000178C
          Up                       0x0000000000001794
          Left                     0x0000000000001796
          Right                    0x0000000000001797
          Down                     0x0000000000001795
          OK                       0x00000000000017A5
          Back/Exit                0x000000000000179F
          Menu/i                   0x000000000000178D
          Vol+                     0x0000000000001790
          Vol-                     0x0000000000001791
          Prev.Ch                  0x0000000000001792
          Mute                     0x000000000000178F
          Ch+                      0x00000000000017A0
          Ch-                      0x00000000000017A1
          Record                   0x00000000000017B7
          Stop                     0x00000000000017B6
          Rewind                   0x00000000000017B2
          Play                     0x00000000000017B5
          Forward                  0x00000000000017B4
          Replay/SkipBackward      0x00000000000017A4
          Pause                    0x00000000000017B0
          SkipForward              0x000000000000179E
          1                        0x0000000000001781
          2                        0x0000000000001782
          3                        0x0000000000001783
          4                        0x0000000000001784
          5                        0x0000000000001785
          6                        0x0000000000001786
          7                        0x0000000000001787
          8                        0x0000000000001788
          9                        0x0000000000001789
          Asterix                  0x000000000000178A
          0                        0x0000000000001780
          #                        0x000000000000178E
          Red                      0x000000000000178B
          Green                    0x00000000000017AE
          Yellow                   0x00000000000017B8
          Blue                     0x00000000000017A9
      end codes

end remote
Views
Notice - this is a static HTML mirror of a previous MediaWiki installation. Pages are for historical reference only, and are greatly outdated (circa 2009).