Sunday, December 02, 2007

MythTV... I am impressed

So, I managed to finally get myth TV up and running... Took a while to get the hang of the configuration options but eventually figured that its not that tough a task at all. and I must say. I am impressed... This is exactly everything I wanted in my first DVR experience... and mythweb simply blows it all away.

Installation was of course a breeze with ubuntu. Simply installed the mythTV packages through the synaptic package manager. The fact that I had got tvtime working had already validated that my tv tuner card was working fine, taking out any possible issues related to that. I followed the configuration instructions on the ubuntu help website for fiesty fawn: https://help.ubuntu.com/community/MythTV.

That should pretty much take you through the basic mythtv backend settings with of course a few deviations for India. This is for my analog cable connection. I am yet to venture into how to get my set top box to work with mythTV, which is my next task.

In the mythtv backend setup, you have 5 options: General, Capture cards, Video Sources, Input Connections, Channel Editor.



Most of the time, you should be ok just picking the default configuration, except for a few deviations for India, which I will detail.

Under General, pick whatever is already selected as default. In the second screen, you need to pick where you will store your recordings. The default value is /var/lib/mythtv/recordings. You may want to modify this to say a USB hard drive you may have to store your recordings. In the third screen, when you hit the global backend setup, you will need to pick a channel frequency table. There is of course no channel frequency table for India. So, to proceed, I picked europe-west. We will anyway override this later on. Pick "PAL" as the TV format. Pick the default option for the rest of the settings in this category.



Under capture cards, when you hit "add new capture card", you should see your tv tuner capture card listed, especially if you got tvtime up and running, this should not be a problem at all.



Next comes the video source. Video source is where your program guide data comes from. There is no India specific video source preconfigured in mythTV since there are no known credible providers of EPG data for India (to the best of my knowledge). So for now, name the video source as "India" and pick "No grabber" under the XMLTV listings grabber options. We will use an alternate method to get guide data which I will explain later on. Pick the frequency table as "europe-west" though this should not have any anyway.



The next setting will be a bit confusing but you will get it as you read on. Under input connections, hook up your television input to the India video source we just created. You will see an option to do a "channel scan" and also you will have an option to specify the "Starting channel". The problem here is, since we do not have a known frequency table for India, a channel scan will be useless. If you use it, you will end up scanning for frequencies in the "europe-west" frequency table. There need be no match between these and the frequencies used by your cable operator in India. So for now, do a channel scan and specify one of the resultant channels as the starting channel, but all this will change in the next step.



Channel editor will be your most important step, one that took me the longest time to figure out. The channel editor allows you to pretty much set up your custom frequency table for India. To be able to do that, you will need to know the frequencies at which your analog cable connection is receiving your various channels. This is where tvtime comes in handy. If you get tvtime-scanner to run on your terminal, it will generate a file in the .tvtime directory inside your home directory called stationlist.xml. The stationlist.xml file will have all the frequencies of all the channels. This frequency is also displayed by tvtime when you flip channels after running the scanner. See screenshots in my previous blog entry. For example: KTV is on 210.5 MHz, Kalaignar TV is on 175.5 Mhz and DD National is being broadcast on 2 frequencies, 182.75 Mhz and 242.5 Mhz.

After noting down the channel names and their frequencies, you would need to add each channel manually through the channel editor. First delete all channels that may have been created by any channel scan you ran before. Then hit "new channel" on the channel editor and start adding channels. For my test run, I picked some Sun Network channels. Example screenshots of the parameters needed to add a channel will look like the following:



Some points to note here. The channel number can be any number that you want to assign. The XMLTV ID is an important parameter as it will help us when we get guide data. For now, follow a simple convention to fill up this field, by just adding a .in to the channel name. For example Sun TV's xmltv id will be suntv.in. In the second screen, note that the frequency is to be entered in KHz and not MHz. So 203.5 Mhz will be entered as 203500.

Enter all your channels and your backend configuration is done and dusted. Exit the backend configuration and you will be asked if you want to run mythfilldatabase. Say yes, so that all the data you entered and the config parameters are stored in the backend mysql database.

Now, you are ready to start the mythtv frontend and begin flipping channels. But we want guide data so that we can exploit mythTV's DVR capabilities to the full dont we? So read on...

The only way that I know of being able to get guide data is by screen scraping websites of channels for this information. Given that mythTV can read the XMLTV format for guide info, we need to generate a xmltv file with guide info for India. Given there is no known grabber (an my knowledge of perl is zero), the best option is to use TVXB. There is a wonderful write up on how to use TVXB for automatic nightly updates of guide data, generation of xmltv files and filling up the mythtv database with updated program guide data every night at http://www.mythtv.org/wiki/index.php/TVxb. So without repeating what's in there, I suggest you follow this HowTO and you should be done.

The most important file you will need is the tvxb config file for India. While there are a few at the tvxb website, some of the entries for the channels dont work any more. Since the Sun Network channels worked great, I took them alone and deleted the rest of the channels for my trial run. One very important point to note is that, there is a xmltv ID for each channel in the ini file and this should match the xmltv id that you entered in the channel editor previously. For example, for sun TV, if you entered suntv.in as the xmltv id in the channel editor for sun tv, the ini file entry for suntv would look like this:

[suntv.in]
name=Sun TV
name=78
url=http://www.sunnetwork.org/tvschedules/schedule.asp?passdate=[day=m/dd/yyyy]&tv=sun
start=1
title=2

The channel number here is 78 but of course, you enter the same number you entered for suntv in the channel editor. So voila, you are done. Once you complete all the steps in the howto for TVXB, you should have everything in place for mythTV to see your program guide data. Here is how my mythTV looks :). I will upload a video soon.