I realize that the release of 9.04 is just right around the corner for Ubuntu, but I have been working on a project to convert the home theater PC from Windows to Linux for the past few weeks. Over the course of this time, I have researched on many different blogs and help forums to piece all of this together. This is specifically for the 32-bit installation as there are many applications that have trouble with the 64-bit installation (like the Sun Java and Adobe Flash plugins).
Please note that this setup is composed of several different parts and pieces – so if you are having various problems with audio, ac3 pass-through or dts pass-through in Ubuntu amongst other things, this might help a bit.
Let’s first start off with getting SPDIF output on Ubuntu Linux 8.10 Intrepid working.
Search Tags:
SPDIF not working in Ubuntu 8.10 Intrepid
Firefox has no sound in Ubuntu 8.10 Intrepid
Coax output doesn’t work in Ubuntu 8.10 Intrepid
Sound doesn’t work in Ubuntu 8.10 Intrepid
OK, those above are mostly to help people find this page to maybe alleviate some of their issues. I had trouble getting SPDIF output working on Linux. This is because Ubuntu now uses the PulseAudio server to play music through the main system and PulseAudio only is setup to detect the primary card, but not the IEC958 / SPDIF output. So for this, we have to change a few settings. Many other people try to completely remove PulseAudio or have very long instructions for a work-around, but this is a bit quicker.
Edit the /etc/pulse/default.pa file and add this line close to the other lines (around line 32):
load-module module-alsa-sink device=hw:0,2
At this point, go ahead and reboot your PC so that PulseAudio is updated with the new module.
The next step is to install the Pulse Audio Device Chooser. Go to Applications – Add/Remove. In the drop-down list that appears, choose “All Available Applications” and then search for “pulse”. Put a checkmark next to the Pulse Audio Device Chooser and hit Apply Changes.
Now, open the program by going to Applications – Sound/Video and then click Pulse Audio Device Chooser. It will open a new icon up by your network or sound on the top bar. Left-click on it once and choose Preferences. In there, put a checkmark next to “Start applet on session login” and hit Close.
Lastly, left-click on it again and choose Default Sink and select Other. In the box that pops up, type in the following:
alsa_output.hw_0_2
Now, open up Firefox or something else that will play some kind of sound. You should now have sound through your SPDIF! If not, there are a few other things to check.
Go to System – Preferences – Sound. In there, make sure you choose your IEC958 device for each of the items (except sound capture). Mine shows up as “NVidia CK8S with ALC655 NVidia CK8S – IEC958 (ALSA)”. For the Default Mixer Tracks, change the drop-down box to your Alsa-mixer (mine shows as “NVidia CK8S (Alsa MIxer)”) In the list of items, ensure “Master” is selected and close the window.
Next, right-click your Volume control on the top bar and choose Open Volume Control. In there, ensure your Alsa Mixer is selected again (mine shows as “NVidia CK8S (Alsa mixer)”). Click the “Preferences” button and put a check mark next to the IEC958 with Playback and Switches on the right-hand column and hit Close. Back in the mixer, scroll over to the right (if needed) and ensure that the IEC958 is not muted. The volume can be all the way down, that doesn’t matter. Now click the “Switches” tab and ensure to put a check mark next to IEC958. Now try to play something on your computer.
Setup SiS Xabre 330 Video Card for Dual-Head Mode in Ubuntu Linux 8.10 Intrepid
I have a SiS Xabre 330 video card. This card has both a VGA connector and a TV-Out connector. In Windows, I could have both a monitor and a TV going with different pictures at the same time – which is called dual-head mode. For Linux, I opted to have the same display on both – just because the only thing we use the TV for is watching movies and the like. Therefore, I “cloned” the desktop (as you will notice below). I highly recommend performing a backup of your /etc/X11/xorg.conf file before making changes to it. I noticed that with the default Ubuntu install, when I would play live TV or movies, the TV shows a blue screen while the monitor would have the movie playing. This configuration corrects that.
Section “Device”
Identifier “Card0”
Driver “sis”
VendorName “Silicon Integrated Systems [SiS]”
BoardName “330 [Xabre] PCI/AGP VGA Display Adapter”
BusID “PCI:1:0:0”
Screen 0
Option “ForceCRT1VGAAspect” “normal”
Option “ForceCRT1Type” “VGA”
Option “ForceCRT2Type” “COMPOSITE”
Option “UseSSE” “on”
Option “TVStandard” “NTSC”
Option “MergedFB” “on”
Option “CRT2Position” “Clone”
Option “MetaModes” “1024×768”
Option “CRT2HSync” “30.0 – 50.0”
Option “CRT2VRefresh” “59.9 – 59.9”
Option “XvOnCRT2” “yes”
EndSection
Section “Monitor”
Identifier “Monitor0”
HorizSync 30 – 95
VertRefresh 75
EndSection
Section “Screen”
Identifier “Primary Screen”
Monitor “Monitor0”
Device “Card0”
DefaultDepth 24
SubSection “Display”
Depth 24
Virtual 1024 768
EndSubSection
EndSection
Section “ServerLayout”
Screen 0 “Primary Screen”
EndSection
One thing to note above is the Option “XvOnCRT2” “yes” line. This line tells the video card to put all video overlay for live TV, movies, or any other motion pictures on the TV-Out port instead of on the VGA port. This means that the blue screen that was on the TV-Out will now be on the monitor when you playback.
Setup MythTV, MythVideo, MythStream, and other applications on Ubuntu Linux 8.10 Intrepid with a Hauppauge PVR-150 Tuner Card
This next section, again, is setup specifically for my needs. But these will also work for you as well. Included is Adobe Flash and Java for Firefox – since Ubuntu does not come bundled with them installed. Let’s get right to it.
At a terminal window, type:
sudo apt-get install mythtv mythvideo mythstream mc flashplugin-nonfree sun-java6-plugin audacious mplayer lirc ncurses-dev gstreamer0.10-ffmpeg gstreamer0.10-fluendo-mpegdemux
Let’s go over what each of these are.
- mythtv – The program for making your PC into a Home Theater PC. MythTV provides the applications for playing and recording Live TV, playing DVDs, playing video/music streams, and allowing you to play your other videos. MythTV has plugins (I use two of them listed below) for providing the functionality. MythTV is kind of like a digital cable box and DVR rolled into one – plus extras. It will also allow you to get Program Guide information (like TV Guide).
- mythvideo – MythVideo is the plugin that will allow you to play videos you have on your computer. In addition, MythVideo also comes with some scripts that will query the IMDB site and download movie posters and other metadata for videos
- mythstream – MythStream is another plugin for MythTV that will play back streaming content from the Internet. You can use it to view movie clips and such from YouTube or DailyVideo. Apparently the developers are trying to get it to work with Hulu, but I haven’t seen this working yet. MythStream also allows you to stream online radio stations from ShoutCast – which is my primary purpose for this plugin.
- mc – This is “Midnight Commander” which is a file editing/manipulation GUI that runs in a terminal window. I use it for editing all the files I need instead of using gEdit or others (quicker at the command line)
- flashplugin-nonfree – This is the Adobe Flash Plugin.
- sun-java6-plugin – This is the Java plugin for Firefox. It will take care of downloading all the other needed Java packages with just this one package.
- adacious – A media player that looks similar to Winamp
- mplayer – A Movie Player that is used by the MythVideo plugin in MythTV to play the movies
- lirc – an Infrared Controller for Linux. If you received a remote with your TV tuner card (as I did with the Hauppauge PVR-150 card), this package will allow you to use your remote to control MythTV and MPlayer (amongst others).
- ncurses-dev – Development package for the LIRC package that is needed
- gstreamer0.10-ffmpeg – This is a package of “codecs” needed to decode videos and other streams. My videos are in XviD format. This package will allow for those to play in addition to AC3 or DTS encoded files
- gstreamer0.10-fluendo-mpegdemux – This package allows you to play back MPEG-2 files in other media players, like Totem.
During the install process, it wll prompt you to enter a MySQL root password – it did twice during my install. Do not enter a password and just hit OK – otherwise the MythTV instalation won’t go as smoothly.
Also – when LIRC is installed, it will prompt you for the remote you are using. In my case, I selected “Hauppauage TV Card”
After it is done installing, it is now time to setup MythTV. Point to System – Administration – and then MythTV Backend Setup. You can change these settings as you wish, but here is what I have.
General
- Time Zone – Auto
- Channel Frequency – us-cable
- Start auto-commercial flagging jobs – Yes
Capture Cards
- Change the drop-down box from V4L to PVR-x50
- Video device at /dev/video0
- Audio device at /dev/vbi0
Video Sources
- There is a blank source – hit Enter to open this one and rename it to Default
- Choose No Grabber
- Frequency is us-cable
Input Connections
- Under Tuner 1 – use the Default video source
- DO NOT Scan for Channels (covered later as the Program Guide setup will allow you to choose which channels you want to include and will not duplicate. If you scan for channels and use my instructions for the program guide, you will have duplicate channels)
Storage
- Put in your location where you want the LiveTV and TV Recordings saved to. Ensure that the mythtv user has access to write to this folder otherwise when you click “Watch TV” in MythTV, it will flash the screen black and then go back to the main menu.
That is all! Now, open the MythTV Frontend which is under Applications – Sound/Video. Then go into the Utilities/Setup menu.
General
- Enable AC3 to SPDIF (allows for pass-through of the better quality sound without changing it to PCM)
- Enable DTS to SPDIF (reason is same as above)
- Passhtrough Output Device – IEC958 (set this if you are using SPDIF for output)
- Audio Output Device – ALSA:SPDIF (set this if you are using SPDIF for output)
- Uncheck the Confirm exit (so MythTV closes instead of asking if you are sure about that)
- Uncheck the auto run Mythfilldatabase (explained later as well with the Program Guide setup)
Appearance (all of these are solely up to you)
- UI Theme – Blootube
- Font Size – Small
- Unhide mouse cursor
TV Settings
General
- Uncheck Auto Expire Default
- Uncheck Strict commercial detection
- Uncheck Run Transcoder (I don’t use transcoders to turn the video format of recorded TV into another since my PVR-150 card automatically encodes in MPEG-2 format)
- Make the Default Transcoder “Autodetect”
- Record past end of show – 0 Minutes
Program Guide
- Guide Starts at Channel 2 (You probably can’t set this until you get the channels setup. I will create the channels with the instructions on the Program Guide below)
- Check Use Select to change channels
- Check Allow channel jump
Playback
- Uncheck extra audio buffering
- Check enable picture controls (allows you to set Brightness, Contrast, Hue during TV or playback)
- Default group filter to apply – “All Programs” (I use this so I can see the LiveTV recordings that haven’t auto-deleted and I can delete them if I wish)
- Automatically Skip Commercials – Automatically Skip
Playback OSD
Recording Profiles
- Ensure the Sampling Rate on all of the MPEG-2 encoders are 48,000
- Change the Bitrate/Maximum Bitrate on all the MPEG-2 encoders (Default, High Quality, Low Quality) to 1900 bits (this will use about 1 GB per hour of recording)
- Change Bitrate for MP3 to 224
Video Settings (only shows up if you installed MythVideo)
General
- Put in the directory location where all of your videos are/will be stored
- Directory to hold the movie posters (directory needs to be created!) – /home/<user>/.mythtv/MythVideo (replace <user> with your username that you will use to run MythTV)
- Default View – Gallery (nice if you have the movie covers, otherwise I would use List)
- Video Gallery – Columns – 3 (a bit scrunched with 4)
Player Settings
If you want to ensure that Mplayer passes through AC3 and also ensure that MPlayer plays through SPDIF, you need to make changes to your /etc/mplayer/mplayer.conf file
Search for “ao” in the file and change the line to show as:
ao=alsa:device=spdif
Search for “ac” in the file and change the line to show as:
ac=hwac3,
Ensure you put the comma after the 3 above so that MPlayer will use other default codecs if the sound is not AC3.
If you have an IR Remote and will be using it – and want to ensure that MPlayer will respond to the commands, you need to add the following entry to the end of the “Default Video Player” and “VCD Player” commands:
-lircconf /path/to/lircrc/file
There you go! That is all the settings (that I use, at least) for MythTV. Now, lets setup MythTV to get Program Guide information.
How To Get Program Guide Information Into MythTV on Ubuntu Linux 8.10 Intrepid
First of all, go to this website and download the mc2xml file. I would recommend placing it in your home folder and then make a new folder called “mc2xml” and place this file in there (and, if you choose, your channel file as well).
mc2xml Download
Now that you have this, you can either decide to import all channels that mc2xml finds for your area, or you can be picky and choose. I choose to be picky because I don’t want all those shopping channels showing up – or channels we never watch. To do this, create a file named mc2xml.chl in the SAME folder as the mc2xml file you just downloaded. On each line put the channel that you want to have.
Now, run the following command in a terminal:
/path/to/mc2xml -c us -g <ZIPCODE>
Ensure you change <ZIPCODE> with your zipcode (do not enclose in those brackets though. The mc2xml program does its thing and will then prompt you to select what TV lineup you want. Select that and it will start downloading the program listings.
Now, you need to fill your database with the new listings. This will also fill it with the channels for MythTV. Issue this command:
mythfilldatabase –refresh-all –file 1 ./xmltv.xml
NOTE: You need to ensure you are in the same directory as the xmltv.xml file, so make sure that you do an “ls” at the terminal to ensure it shows up there. The process of filling the database may take a little bit of time.
Now, the question comes up – How can I have this run and automatically update the program guide before the program guide runs out (usually around 14 days)? Good question! Below is a script that will do just that – save it, again, in the mc2xml folder in your home directory:
#!/bin/sh
cd ~/mc2xml
if ~/mc2xml/mc2xml ; then
mythfilldatabase –refresh-all –file 1 ./xmltv.xml
fi
Save the file as whatever you would like, but I saved mine as “mythtv-schedule.sh”
Now, you need to create a cron job to run. Mine is set to run at midnight every night (it is a bit overkill, but if there are any changes in the schedule it will update them daily). Navigate to the /etc/cron.d folder and create a new file called “mythtv-schedule” and enter this:
0 * * * * user ~/mc2xml/mythtv-schedule.sh
Ensure you change “user” to your username that you use on your PC.
There you have it! Now you will have your program guide automatically populated with data in MythTV so you can schedule recordings and use the OSD while watching TV to browse the channels and see what is showing – just like a digital cable box!
Setup the Hauppauge Infrared Remote with MPlayer and MythTV on Ubuntu Linux 8.10 Intrepid
This is specifically for the Gray Hauppauge remote I received with the PVR-150. It is the same remote as the WinTV-Go-Plus cards as well (that was the first card I bought).
Ensure that you installed lirc and libcurses-dev. If not, run this at a terminal:
sudo apt-get install lirc ncurses-dev
When it prompts you for your remote, choose Hauppauage TV Card.
After this, you need to ensure the LIRC program will start up, so type this in a terminal:
echo “lirc_i2c” | sudo tee –a /etc/modules
Now open the /etc/modprobe.d/aliases file and scroll down to the proper area and add the following line and save:
alias char-major-61 lirc_i2c
Now, you need to have a file that tells MythTV and other programs what each button the remote does. You can download the file I use (works well but takes getting used to) HERE.
You need to copy this file to /home/<user>/.mythtv/lircrc where you substitue <user> with your username. It must be placed here in order for MythTV to find the file to use.
Additionally, if you use MythVideo, you need to ensure that MPlayer (the player used for videos) can find the file.
- Open MythTV Frontend
- Go to Utilities/Setup
- Go to Media Settings
- Go to Video Settings
- Go to Player Settings
- In the commands for VCD and Video, add on to the very end (if you didn’t do it in the above steps for general MythTV setup):
-lircconf /home/<user>/.mythtv/lircrc
Again, substitue your userid with <user>
Your remote should now be complete!
If you want to set your remote to open MythTV if it is not currently open with your remote, follow these few small steps.
Create a file called .lircrc in your home folder:
touch ~/.lircrc
In that file, copy/paste the following. This will make it so that when you hit the Power button, it will open MythTV:
# power button
begin
prog = irexec
button = POWER
#repeat = 4
config = mythfrontend –service
Now, ensure that the irexec program automatically starts upon booting Ubuntu. To do this, go to Menu – System- Preferences – Startup Applications.
In here, click Add. For a name, just put in irexec and put in irexec for the command as well.
In addition, if you wish to use other buttons on the remote to launch other applications while MythTV is not open, just add those extra items to the ~/.lircrc file as well.
Setup MythTV with MythStream with the ShoutCast Parser in Ubuntu Linux 8.10 Intrepid
Like I previously indicated, I use MythStream solely for the ShoutCast recordings. Ensure you have MythStream installed:
sudo apt-get install mythstream
Now you need to go to the creator’s website and download the Shoutcast parser. Untar the files to /home/<user>/.mythtv/mythstream/parsers
Open up MythTV, go to Media Library – Play Online Streams and you will have a “Browse Shoutcast genres” available. All of the radio stations are available right there!
NOTE: If you cannot hear any of the playback through SPDIF, it is because you need to update your /etc/mplayer/mplayer.conf file.
Search for “ao” in the file and change the line to show as:
ao=alsa:device=spdif
How To allow for DVD Playback in MythTV on Ubuntu Linux 8.10 Intrepid
For the DVD playback to work, you need to download some CSS stuff. I tried to play a DVD without this package, and the drive just flashed for over ten minutes and did nothing.
At a terminal, type:
sudo wget http://www.medibuntu.org/sources.list.d/intrepid.list –output-document=/etc/apt/sources.list.d/medibuntu.list
sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update
sudo apt-get install libdvdcss2
How To Bulk import IMDB Data for Videos for MythStream in Ubuntu Linux 8.10 Intrepid
If you have a lot of videos and do not want to manually go through the list and pull IMDB data for each, here is how you can do it all at once!
Download these two files and untar them to a temp directory on your desktop (or whever):
imdbupdater
metacleanup
Now, after untarring the files, open up the metacleanup.sh file. Most of these settings should already be fine, but you will need to put in your MythTV database password (this can be found in /etc/mythtv/mysql.txt) and the location to where your videos and posters are located. I would recommend creating the posters folder at /home/<user>/.mythtv/mythvideo/posters and replace <user> with your userid.
Now, to update ALL IMDB information for the videos you have, enter this in a terminal (need to be in the same directory as the imdb-bulk-update script):
./imdb-bulk-update.pl -A -Host localhost -User mythtv -Password <PASSWORD_HERE> -Fileup -Folder <PATH_TO_MOVIES>
Ensure you update <PASSWORD_HERE> with your mythtv database password (again, found in /etc/mythtv/mysql.txt), and update the <PATH_TO_MOVIES> with the location where your movies are stored so the script can find all of them.
During the process, if there are a few results for a movie returned, you will be asked to select which movie on which year.
How To Start MythTV upon login on Ubuntu Linux 8.10 Intrepid
Since I didn’t install Mythbuntu, I wanted to find a way to get MythTV to run when the user logged in (I have the user set to auto-login as well – so I turned the PC on, wait for it to boot, and then MythTV comes up with no interaction – that way I can just sit on the couch and use the remote from the start).
mythfrontend –service
Hit OK and MythTV will now launch when you boot up!
How to share MythVideo movies on the backend server with other MythTV Clients
For simplicity sake, go to the Mediashares site and read instructions how to setup NFS so your MythVideo movies can be shared amongst other frontend MythTV computers.
How to setup Boxee integration and remote control access with MythTV
Recently I installed Boxee and I like the way it integrates several online webcasting and webvideo functions. This is a perfect solution for allowing quick and easy access to a plethora of videos online that are available – with the ease of use of integration into MythTV with remote control access.
First of all, you will need to install Boxee. To do this, you need to go to your Software Sources, click the Third Party tab, and enter a new line:
deb http://apt.boxee.tv jaunty main
Then, reload your sources and install Boxee:
sudo apt-get install boxee
After Boxee is installed, you will need to add a line entry to your MythTV Menu. I put mine under the Recordings menu. Open up the /usr/share/mythtv/library.xml file and add this to it. Where you put it depends on where you want it since the order they appear in this XML file will be how they appear on the menu in MythTV:
<button>
<type>TV_WATCH_RECORDINGS</type>
<text>Launch Boxee</text>
<action>EXEC /opt/boxee/run-boxee-desktop</action>
</button>
Now save and close the file. You have just integrated Boxee into MythTV.
Next is setting up the remote. In this case, it is very important that you setup your remote correctly.
First of all, it is best if you run irw to find what the remote name is. Simply issue:
irw
at a command prompt and press a few keys on your remote. You should see some garbage information, the button that was pressed (like Power, VolUp, Left, Right, etc), and then the remote name. In my case, it says “Hauppauge_350”. This information must be EXACT in the two files you create for the Boxee remote control. You can then hit Ctrl+C to get out of the irw prompt.
This is the code I have for my remote. This file needs to be saved in two places. If you only save it in your home directory, it still won’t work (at least it didn’t for me). Save this file as lircmap.xml:
<lircmap>
<remote device=”Hauppauge_350″>
<pause>Pause</pause>
<stop>Stop</stop>
<forward>Forward</forward>
<reverse>Rewind</reverse>
<left>Vol-</left>
<right>Vol+</right>
<up>Ch+</up>
<down>Ch-</down>
<select>Ok</select>
<pageplus>Red</pageplus>
<pageminus>Yellow</pageminus>
<back>Back/Exit</back>
<menu>Menu</menu>
<title>Play</title>
<info>More</info>
<skipplus>Skip</skipplus>
<skipminus>Replay</skipminus>
<display>Blank</display>
<start>Home</start>
<record>Record</record>
<volumeplus>Green</volumeplus>
<volumeminus>Blue</volumeminus>
<mute>Mute</mute>
<power>Power</power>
<myvideo>Videos</myvideo>
<mymusic>Music</mymusic>
<mypictures>Pictures</mypictures>
<mytv>TV</mytv>
<one>1</one>
<two>2</two>
<three>3</three>
<four>4</four>
<five>5</five>
<six>6</six>
<seven>7</seven>
<eight>8</eight>
<nine>9</nine>
<zero>0</zero>
<mytv>Red_</mytv>
<mymusic>Green_</mymusic>
<mypictures>Yellow_</mypictures>
<myvideo>Blue_</myvideo>
</remote>
</lircmap>
Note above the device=”Hauppauge_350″ line. You need to change what is in quotes to what you saw when you used the irw command for your device name.
The file needs saved in these two locations:
~/.boxee/UserData/lircmap.xml
/opt/boxee/UserData/lircmap.xml