<<

KNOW-HOW MythTV

Building a home media center with MythTV TV IN MythTV and its extensive ecosystem of add-ons let you turn your Linux computer into a full-featured home media center. BY PATRICK DAVILA

ythTV is a collection of soft- front end may or may not reside on the ware tools for TV in Linux. same computer as the back end data- MThe MythTV website [1] calls base. You could build one master MythTV “a GPL-licensed suite of pro- MythTV server that holds all of your dig- grams that allow you to build a mythi- ital media. Multiple clients could then cal home media convergence box on access the server over the network. your own using Open Source software Some creative MythTV client set- and operating systems.” MythTV ups have included X-boxes and provides an interface from your bootstrapped diskless set top computer to your cable or sat- devices. ellite television service. You can You can set up a dedicated use MythTV to pause, rewind, MythTV server, or you can even or fast forward television pro- set up MythTV on your main grams. MythTV with a video workstation and let it act as the capture card lets you record TV Fotolia Angeltun, Joachim server portion of your home digi- programs. And MythTV runs on tal media center. You’ll find nu- a network-ready Linux system, merous HowTo documents on so you can configure several configuring MythTV with almost front-end devices in your house all of the popular Linux distribu- to view and access a common set tions (, Fedora, Gentoo, of video resources. Slackware, Suse, , etc.). At first glance, MythTV looks like For this article, will build a dedi- nothing more than a Open Source cated MythTV box that will act as clone of Tivo – a hard-disk-based video both a client and server. For this pur- recorder that’s basically a digital version pose, I will use a small, specialized of a VCR. But MythTV offers much more PC that will reside with the rest of the functionality than Tivo. , it can re- audio/ video equipment inside of a cord, pause, and playback your favor- stereo component rack. ite TV shows, but it also offers a huge suite of add-on applications that can do “MythTV Add-ons.”) These features Getting the Hardware much more. Also, because MythTV is an make MythTV the first true home media The of a MythTV box is the TV Open Source project, it is not feature-en- center. Best of all it, was developed and tuner card. MythTV is flexible enough to cumbered like many of the commercial implemented entirely on Linux. Ports of use anything from raw video capture DVR systems. For example, MythTV pro- MythTV also exist for Apple OSX and cards (that do not encode the video) to vides automatic commercial skipping. FreeBSD. high definition cards. Although raw tun- On the other hand, although you used ers cards such as those based on the to be able to hack your Tivo to skip Modular Design BT878 chipset are the cheapest, they will commercials, Tivo is now implementing The MythTV suite is modular in design. be the most taxing to your system. All flash-based pop-up advertisements The main application includes a front the encoding will be done by the CPU. that will display when the user is fast end and a back end. The back end is This may be an issue if you want to forwarding. where the scheduling of recordings takes watch a previously recorded show while The MythTV project was started by place. A MySQL database houses pro- recording another program. Isaac Richards in 2002 and has devel- gramming information and catalogs re- The solution to this problem is to use oped into a very active community that cordings currently residing on the sys- a hardware-based encoder card that will is constantly implementing new features tem. A user interacts with the applica- encode the captured video signal on the and add-ons. (See the box titled tion through the front-end GUI. The fly to a standardized video format.

52 ISSUE 71 OCTOBER 2006 WWW.LINUX - MAGAZINE.COM MythTV KNOW-HOW

Figure 1: From the outside, my home-built MythTV box looks like a Figure 2: The inside of my MythTV box looks much more like an ordi- standard home media device. nary PC.

MPEG2 is the current standard video the CPU. Thus you can continue to use all Hauppauge cards usually come with compression format used around the your system for other tasks while it’s re- remote controls, along with an infrared world. The biggest drawback of MPEG2 cording TV programs. Currently, high receiver for the encoder card. files is that they are quite large. 1 hour of definition TV sets and recorders are still One of the main requirements for my high quality standard definition video fairly expensive, even though high defi- MythTV box is that it’s the center of my will be about 1 Gig in size. The biggest nition capture cards are relatively cheap. home theater setup. Yes, you can use a plus for hardware-based encoder cards is (See the box titled “High Definition Cap- standard PC tower case, but it won’t be that they will only use about 4–8% of ture Cards.”) very aesthetically pleasing. Therefore, Since I currently don’t own a high def- the case should look like it belongs in MythTV Add-ons inition TV set, I chose to go the standard the stereo cabinet with rest of your A/ V The current list of MyTV add-on appli- definition route. Unlike the commercial components. I settled on a black Cooler cations is quite impressive: DVR products currently available on the Master ATC-620 case, which fits perfectly • Myth Browser – market, you can upgrade your MythTV in my component stereo rack. Since I de- system to a high definition setup when cided on a Mini-ATX case, I went and • Myth DVD – DVD manager/ player that lets you rip DVDs it becomes feasible. purchased an MSI 651M motherboard. The most popular brand of standard The next question is how much horse- • Myth Flix – view your movie queue definition encoder cards is Hauppauge. power do you need to run MythTV? The from (popular on-line movie rental service) The Hauppauge 500 comes with two en- very first time I tried out MythTV, I used coder chips and sells for about US$ 160. a Hauppauge 350 card with an 800 Mhz • Myth Gallery – photograph manager/ viewer Two encoder chips are useful if you want Intel Pentium 3. I was able to get away to watch a program that is different from with this because of the decoder chip • Myth Game – play your favorite old school video games via game emu- the one you’re recording. The Haup- the 350 uses. These days, processors are lation pauge 250 comes with a single encoder relatively inexpensive. If you’re going to chip and sells for about US$ 130. In have the CPU handle playback, you • Myth Music – audio file manager/ player that lets you rips CD s into your addition to one encoder chip, the should get at least a 1.5 GHz processor. favorite formats Hauppauge 350 also comes with a de- I installed 512 MB memory on my sys- • Myth News – RSS feed reader coder chip. This saves considerable re- tem even though the minimum require- sources when playing back recordings. • Myth Phone – SIP based VOIP The 350 model also comes with a com- High Definition • Myth Stream – listen to streaming bined A/ V connection, breakout cable audio content from the internet Capture Cards (with S-Video, composite video, and ste- Some examples of high definition • Myth Stream TV – stream your TV reo audio out) and FM radio receiver and capture cards include: recordings over your network via VLC antennae. The 350 sells for about US$ • Air2PC PCI (8VSB) • Myth Video – video player for files not 160. The newest model from Hauppauge recorded via MythTV • pcHDTV-2000 (8VSB) is the 150, which is very similar in func- • Myth Weather – weather forecasts for tion to the 250 and sells for about half • Air2PC HD5000 (8VSB, QAM256) – your local area US$ 120 (EUR 95) the cost. • Myth Web – control the scheduling of All of the aforementioned Hauppauge • pcHDTV-3000 (8VSB, QAM256) – US$ 170 (EUR 135) recordings via the web cards are extensively supported in Linux • Myth Burn – archive recorded shows by the ivtv driver. With the exception of • dvico Fusion HDTV Lite 5 (8VSB, to DVD the MCE version of the Hauppauge 150, QAM256) – US$ 120 (EUR 95)

WWW.LINUX - MAGAZINE.COM ISSUE 71 OCTOBER 2006 53 KNOW-HOW MythTV

ment is 256 MB. One area where you depending on the country where you re- need to finish your network configura- shouldn’t hold back in spending is hard side. Please check the MythTV wiki on tion by deciding if you want static or drive capacity. Basically, more is better. XMLTV for your options [3]. dynamic IP addresses. You are then I recommend getting at least a 200 GB presented with the option of configuring hard drive – especially since hard drive Installing MythTV via your remote control. You can select prices are dropping quickly. 1 GB video KnoppMyth from 42+ brands of remote controls, files will chew up your hard drive space KnoppMyth is the easiest way to setup a including the ones bundled with the fairly quickly. dedicated MythTV box [4]. The Knopp- Hauppauge capture cards. If you make The good news is you can always add Myth distribution is based on Debian a mistake configuring your remote, you more hard drives later. Although a DVD and uses the auto-detection scripts based can simply rerun the setup script at any- burner is not required, a burner will on the live CD distribution. Be- time by typing: come in handy if you’d like to archive fore starting the installation process, it is some of your favorite recordings. An- very important to investigate how you #: /usr/local/bin/U other area where you shouldn’t be mi- will import TV listings into your system. -reconfig.sh serly is a higher quality silent power At the first prompt, you can get the op- supply. This is especially true if you tion of doing an auto install, running as You are then asked if you want to add need to power multiple drives. In my a front end, doing an upgrade, or doing a additional i686 modules; if not, you can past experiences, a cheap power supply manual install. For most people, the auto go with the default settings. The script is usually the first component to fail in install is sufficient. On multiple occa- then goes about installing the main a system. sions, you will be presented with a MythTV add-on modules. Video card requirements are fairly warning that your hard drive will be The main myth-setup script starts up light with MythTV. I picked up a used completely re-written. The installer will and asks you to enter your language card for about US$ 20. The card then ask you to set up a regular user ID preferences. You then need to do some has an S-video out for my TV connec- in addition to a root password. general MythTV configuration: tion. If you’re using a Hauppauge 350 Another final warning gives you the • General – has the IP addresses for card and don’t need any 3D acceleration, option to quit the install. The installer your back-end server and ports that stick with the motherboard’s on-board scripts then start off by partitioning your MythTV will run on. If your MythTV video. If you plan on connecting your hard drive and setting up a customized box will serve as a both a front and MythTV box to your version of Debian running the 2.6 ker- back end system, leave the defaults (IP wirelessly, use at least a 802.11g network nel. After the initial installation, the sys- address of 127.0.0.1, etc.). The next card. 802.11b will not be fast enough to tem reboots. At this point, the driver has screen will have TV format (NTSC or stream large video files. been set up for your Hauppauge capture PAL) and channel frequency settings card along with accelerated 3D drivers (us-cable, us-bcast, us-cable-hrc, Programming Guide for NVidia graphics card owners. us-cable-irc, japan-bcast, japan-cable, You’ll need a service on the Internet Upon the first login, you are prompted europe-west, europe-east, italy, that provide television programming in- to sign on as root and complete the newzealand, australia, ireland, france, formation. If you are located in North MythTV configuration process. You first china-bcast, southafrica, argentina, America, for instance, you may want to set up an account with zap2it [2]. This Buying the Box account will be used by MythTV to pull Cost of MythTV box components: down all the TV programming - • MSI 651M-L motherboard US$ 25 (EUR 20) tion that is stored in the database. zap2it is kind enough not to charge anything to • 2.4 Ghz Intel Celeron processor with fan US$ 50 (EUR 39) the MythTV community for this service, • 512 MB memory (PC3200) US$ 40 (EUR 31) but in fact, zap2it provides the same ser- • 250 GB 7200RPM hard drive US$ 80 (EUR 62) vice to many of the commercial DVR • Hauppauge WinTV DVR 150 card US$ 60 (EUR 47) products for a fee. • Geforce MX440 AGP video card with video out US$ 20 (EUR 16) Go to the website http:// labs. zap2it. • Cooler Master ATC-620C Micro ATX case: US$ 75 (EUR 58) com and enter code: • Ultra silent 300 watt CMAX power supply US$ 30 (EUR 23)

'ZIYN-DQZO-SBUT' • NEC Dual Layer DVD burner US$ 40 (EUR 31) • Lite-On wireless keyboard US$ 15 (EUR 12) You will then be prompted to create a Total cost: US$ 435 (EUR 339) user name and password. Write these Costs of comparable commercial offerings: down, as you will need them during the • Tivo: US$ 255-355: US$ 100-200 + US$ 155 (yearly guide subscription fee) installation process. • HP z545 Digital Entertainment System: US$ 1,800 (runs with Windows If you live outside of North America Media edition) you will need to setup XMLTV, and you • Alienware DHS System: US$ 1,600 (runs with Media edition) may have to do additional configuration,

54 ISSUE 71 OCTOBER 2006 WWW.LINUX - MAGAZINE.COM MythTV KNOW-HOW

australia-optus). The next couple of name you provided for your listings good video connection that will need screens will have some back-end job profile. It will then scan your TV card some manual configuration. Basically options, such as if you want to use for active channels based upon your you will need to have the video piped autostart and transcode after recording XML listings preferences. out to a frame buffer device [5] [6]. shows. European Users will have to make If you purchase the less expensive • Capture cards – Select new capture several key changes in the -setup: Hauppauge 250 or 150, you will need a card. You must then enter a supported • TV format = PAL video card with a video out connection. card type (analog V4L card, MJPEG • VBI Format = PAL Teletext The low end NVidia MX420/ 440 is rela- cards such as Matrox G200, MPEG-2 • Channel Frequency table = tively cheap. You will have to slightly encoder cards such as the Hauppauge europe-west modify your Xorg/ XF86 configuration line, DVB DTV cards, pcHDTV DTV You need to adjust the screen size from file. My file has the following settings: cards, firewire cable box, USB MPEG-4 the recording profiles setup screen: Main devices such as Plextor ConvertX, and Menu | Setup | TV | Recording profiles. Section "Device" Dbox2 TCP/ IP cable box). The profiles need to have the height Identifier "Videocard0" • Video sources – Select a new video changed from 576 to 480 and the width Driver "nvidia" source. Enter a generic name and se- changed from 480 to 720. In the /etc/ VendorName "EFX" lect the appropriate XMLTV listings mythtv/modules/ivtv file, tuner type=1 BoardName "nVidia U grabber. For North America, select has to be replaced with tuner type=5. GeForce 4 MX 420" DataDirect. Then enter your user ID You’ll also need to add the following #TV Out and password you created at the entry: Option "TVStandard" "NTSC-M" zap2it registration site. Hit enter; the Option "TVOutFormat" "SVIDEO" setup script then retrieves your chan- rmmod tveeprom modprobe U EndSection nel lineup and populates the database tveeprom dmesg with the appropriate cable/ satellite My file also contains the settings shown provider system information. You will And /etc/sysconfig/ivtv/cfg should have in Listing 1 to specify a television set. then need to select an input connec- the following: tion. Select tuner and match it to the The Cable or Satellite IVTV_TUNER=X U Receiver TV Standards IVTV_TYPE='PAL' If you use a digital cable or satellite tele- Depending on your location, you may vision system, you will have to configure wish to try one of the following X is the tuner type and should be re- a serial port infrared blaster. An IR- “TVStandard” values: placed with the appropriate value. blaster tricks the cable/ satellite box into • “PAL-B” – used in Belgium, Denmark, After the initial setup is complete, you Finland, Germany, Guinea, Hong will see a message about running myth- Listing 1: Specifying a Kong, India, Indonesia, Italy, Malaysia, filldatabase to populate your back end Television Set The Netherlands, Norway, Portugal, database. Knoppmyth then automati- 01 Section "Screen" Singapore, Spain, Sweden, and cally tries to configure your Mythweather Switzerland settings based upon your provider’s sys- 02 Identifier "Screen0" • “PAL-D” – used in China and North tem area. The installer will then auto- 03 Device "Videocard0" Korea matically run the mythfilldatabase com- 04 Monitor "Monitor0" mand, which fills the database with two • “PAL-G” – used in Denmark, Finland, 05 DefaultDepth 24 Germany, Italy, Malaysia, The Nether- weeks worth of programming schedules. lands, Norway, Portugal, Spain, Once that’s done, MythTV will startup 06 SubSection "Display" Sweden, and Switzerland for the first time. You will then see a 07 Depth 24 • “PAL-H” – used in Belgium message about pre-scaling theme images 08 Modes "1024x768" "800x600" • “PAL-I” – used in Hong Kong and and the front-end GUI becomes active. "640x480" You are now ready to start using United Kingdom 09 EndSubSection • “PAL-K1” – used in Guinea MythTV. At anytime, you can rerun the MythTV setup interfaces by issuing the 10 EndSection • “PAL-M” – used in Brazil following command: 11 Section "Monitor" • “PAL-N” – used in France, Paraguay, 12 Identifier "Monitor0" and Uruguay mythtv-setup • “PAL-NC” – used in Argentina 13 VendorName "Monitor Vendor" • “NTSC-J” – used in Japan The Video Signal 14 ModelName "32in Analog TV" • “NTSC-M” – used in Canada, Chile, The quality of the signal is determined 15 HorizSync 30.0 - 50.0 Colombia, Costa Rica, Ecuador, Haiti, by the quality of the TV capture card you 16 VertRefresh 60.0 - 60.0 Honduras, Mexico, Panama, Puerto purchased for your system. If you decide 17 Option "dpms" Rico, South Korea, Taiwan, United to purchase the more expensive 18 EndSection States of America, and Venezuela Hauppauge 350, you will have a very

WWW.LINUX - MAGAZINE.COM ISSUE 71 OCTOBER 2006 55 KNOW-HOW MythTV

Figure 3: MythTV provides a simple and practical main menu for Figure 4: The MythWeather add-on offers weather information cour- managing media content options. tesy of the Weather Channel. thinking the user is changing the chan- will then be able to view the transparent lect a program to be recorded, you have nels via the receivers remote control. on-line guide while your show is still the option of making it record at regular You can construct your own IR-blaster if viewable. You can scroll right and see intervals (similar to the season pass fea- you’re moderately handy with a solder- what will be the channel you’re cur- ture in Tivo) or as a one time instance. ing gun, or you can purchase a pre- rently viewing. You can also move up For setting up your audio collection, assembled IR-blaster at a minimal cost and down to see what’s on the other you start by listing the default directory from [7]. channels. This is similar to viewing pro- where your audio files will reside The current version of KnoppMyth gramming guides on a digital cable or MythTV/Utilities/Setup/Media Settings/ (R5B7) has an option to configure an IR- satellite system. Music Settings. You can then copy your blaster. Unfortunately, this feature does Scheduling recordings is very easy. Go music collection into the music directory not work correctly. To remedy this, Greg into the Schedule Recordings menu item remotely via SSH or fish in Konqueror. Frost has posted a work around in the and browse the program guide. The da- You can also rip and encode new CDs mysettopbox forums [8]. tabase typically holds two weeks worth by selecting import CD from the main An out-of-the-box solution to this of programming information, so setting music menu. You have the option of en- problem is in development for the next up recordings for while you’re on vaca- coding your ripped songs to either OGG, release of KnoppMyth. tion shouldn’t be a problem. MP3 or FLAC. You can also create music In a nutshell, you will need to create a You can also find a particular show by play lists or have MythMusic play ran- second instance of LIRC or some equiva- using the search function. When you se- dom songs. MythWeather will display lent script to run at startup. You will then need to create a script that will change the channels on the receiver. Dif- ferent cable/ satellite boxes will require slightly different configurations, depend- ing on the manufacturer make and model. For non KnoppMyth setups, you can follow the guide at [9], which is fairly distribution neutral. Day to Day If you’ve familiar with Tivo or other commercial DVR systems, the menus in MythTV look very familiar. From the main menu (Figure 3), you can go watch live TV, schedule upcoming recordings, and go into the different add-on applica- tions. When watching live TV, you can pull up the system menu with the m key and browse what’s on other channels. You Figure 5: MythWeb lets you connect to your MythTV box from over the Internet.

56 ISSUE 71 OCTOBER 2006 WWW.LINUX - MAGAZINE.COM KNOW-HOW MythTV

veat to external access is The next step is to umount the /dev/ forwarding port 80 vg/myth partition: through your network firewall. This feature is umount /myth especially useful if you’re on the road and Then format the /dev/vg/myth partition want to make sure your with the file system of your choice : favorite TV shows will be recorded for you. mke2fs -j -O sparse_super -m0 U MythTVBurn is a fairly -i8000000 -L myth /dev/vg/myth new add-on application that is especially useful Remount the /myth partition: if you have a DVD burner in your Myth mount /myth Figure 6: With MythTV, you can even search the web while box. The program lets watching television. you take previously re- And restore any files that were destroyed corded programs and in the LVM formating process. your local weather forecast, along with burn them to DVD. screen captures of Doppler radar for Conclusion your local region (Figure 4). (This fea- Adding Storage Space MythTV is an incredibly powerful appli- ture is based on an interface with the If you get to the point where you’re run- cation that let’s you do everything a Weather Channel website.) ning out of disk space and refuse to ar- commercial DVR can do and much more. If the location is incorrect, you can chive old shows to DVD, you can add an The power of MythTV lies in the fact change it in the setup menu Utilities/ additional hard drive. The best solution that MythTV enables users and develop- Setup | Setup | Info Center Settings | for adding more hard drive space is ers to come up with new and innovative Weather Settings. MythVideo allows the using LVM (Logical Volume Manager). ways to improve and extend its function- playback of a multitude of video codecs For all intents and purposes, hard drives ality. The MythTV project is not limited (mpeg, avi, divx, xvid, qt, wmv, etc..) by set up with LVM will be treated by the by corporate monetary interests or con- using Mplayer on the back end. Myth- system as single hard drive partitions. strained by development teams who are DVD allows you to rip and store your You will have to backup any programs told what to work on. The only possible DVD collection to your hard drive. This you’ve recorded, as they will be wiped obstacle is small minded legislation paid feature is convenient if you hate having out when setting up LVM. This is be- for by the entertainment industry that to go searching for the same DVDs over cause you are reformatting the partitions would outlaw digital recordings for per- and over again. For the retro gaming en- where your video files will reside. Set- sonal fair use. But alas, that is an argu- thusiasts, there’s MythGame, which al- ting up LVM would normally involve ment for another day. ■ lows you to run old ROM images of Atari many steps, but the developers of and NES games via the MAME and SNES KnoppMyth have created a script to sim- INFO emulators. Legally you are required to plify the process. To set up LVM, log into [1] MythTV: http:// www. mythtv. org/ own the actual ROM cartridges, even a console session as root and use cfdisk [2] Zap2It: http:// www. zap2it. com/ though there are numerous websites al- to create a partition on your new hard [3] MythTV wiki on XMLTV: http:// www. lowing downloads of all your favorite drive called /dev/hdb1. Then run the cre- mythtv. org/ wiki/ index. php/ XMLTV classic games. ate_lvm.sh script and pass the partition [4] KnoppMyth: One of the newest add-on applications names you want to combine: http:// knoppmythwiki. org is MythStreamTV, which allows you to [5] Hauppauge 350 with KnoppMyth: stream your videos over the network. create_lvm.sh /dev/hda3 U http:// knoppmythwiki. org/ index. php?p Streaming is great if you want to take a /dev/hdb1 age=HauppaugeThreeFiftyInstallation break from a long night of coding and [6] IVTV driver install: http:// mythtv. org/ watch a recorded program from your For SCSI disks, use the following com- wiki/ index. php/ IVTV_Installl workstation. mand: [7] IR-blaster: http:// www. irblaster. info/ By far the most impressive of the add- [8] IR-blaster workaround: on applications is MythWeb. MythWeb create_lvm.sh /dev/sda3 U http:// mysettopbox. tv/ phpBB2/ viewtopic. php?t=9352&postdays=0&p allows you to interface with your /dev/sdb1 ostorder=asc&start=0 MythTV box over the Internet (Figure 5). [9] MythTV with LIRC: Basically, an Apache web server is setup The script will create disk volumes and http:// losdos. dyndns. org:8080/ public/ with access given only to your regular modify the /etc/fstab file with the new mythtv-info/ MythTV_DISH_IR_LED_ user ID. You can view the program partitions. This script should be started TX_via_Modified_LIRC. html schedule, delete old shows, schedule by the command create_lvm.sh followed [10] Linux HTPC Howto: new shows, and even control streaming by the list of devices (partitions) to be http:// www. linuxis. us/ linux/ media/ video via MythStreamTV. The only ca- included in the volume group. howto/ linux-htpc

58 ISSUE 71 OCTOBER 2006 WWW.LINUX - MAGAZINE.COM