Project

General

Profile

Tvheadend NTSC » History » Version 5

chris1h1 -, 2010-05-27 04:49

1 1 chris1h1 -
2
3 5 chris1h1 -
h2. Analogue NTSC with HTS-Tvheadend
4
5
6 1 chris1h1 -
Tvheadend does not work "out of the box" with analogue NTSC, rather it is necessary to compile tvheadend from source. This guide is aimed at relative Linux novices, and reflects the steps that I took myself when starting with a fresh installation of XBMC Live. Credit is due to Hein (who in turn credited Ram) from the tvheadend mailing list for getting me off on the right track.
7
8
First, make sure you have the packages installed that are required to build tvheadend:
9
10 5 chris1h1 -
<pre>
11 1 chris1h1 -
sudo aptitude install build-essential libavahi-client-dev subversion
12 5 chris1h1 -
</pre>
13 1 chris1h1 -
14
Now create the following directory. This is where we'll download the source code to and eventually build the application:
15
16 5 chris1h1 -
<pre>
17 1 chris1h1 -
mkdir -p /opt/tvheadend/src
18 5 chris1h1 -
</pre>
19 1 chris1h1 -
20
Now you need to check out the Tvheadend source code using svn:
21
22 5 chris1h1 -
<pre>
23 1 chris1h1 -
svn co svn://svn.lonelycoder.com/hts/trunk/tvheadend /opt/tvheadend/src/
24 5 chris1h1 -
</pre>
25 1 chris1h1 -
26
We need to make a small edit to a file to switch analogue support from PAL to NTSC:
27
28 5 chris1h1 -
<pre>
29 1 chris1h1 -
cd /opt/tvheadend/src/src
30
nano v4l.c
31 5 chris1h1 -
</pre>
32 1 chris1h1 -
33
Press Cntl + W to perform a search in this file. Search for the following:
34
35 5 chris1h1 -
<pre>
36 1 chris1h1 -
v4l2_std_id
37 5 chris1h1 -
</pre>
38 1 chris1h1 -
39
Change:
40
41 5 chris1h1 -
<pre>
42 1 chris1h1 -
v4l2_std_id std = 0xff;
43 5 chris1h1 -
</pre>
44 1 chris1h1 -
45
To:
46
47 5 chris1h1 -
<pre>
48 1 chris1h1 -
v4l2_std_id std = V4L2_STD_NTSC;
49 5 chris1h1 -
</pre>
50 1 chris1h1 -
51
Cntl + X to close, Y to save, Enter/Return to save with the existing file name.
52
53
Run the configuration script:
54
55 5 chris1h1 -
<pre>
56 1 chris1h1 -
cd ..
57
./configure --prefix=/opt/tvheadend --release
58 5 chris1h1 -
</pre>
59 1 chris1h1 -
60
If all went well you can compile the Tvheadend source code:
61
62 5 chris1h1 -
<pre>
63 1 chris1h1 -
make
64 5 chris1h1 -
</pre>
65 1 chris1h1 -
66
If the source is compiled with no errors you can install the compiled source:
67
68 5 chris1h1 -
<pre>
69 1 chris1h1 -
make install
70 5 chris1h1 -
</pre>
71 1 chris1h1 -
72
Stop the existing version of tvheadend, in order to copy the new files over the existing ones. Find the PID of everything running that includes "tvheadend" in the name:
73
74 5 chris1h1 -
<pre>
75 1 chris1h1 -
ps aux | grep tvheadend
76 5 chris1h1 -
</pre>
77 1 chris1h1 -
78
The PID is the first number, after "hts". Kill it (replace PID with the actual number from the previous command):
79
80 5 chris1h1 -
<pre>
81 1 chris1h1 -
sudo kill PID
82 5 chris1h1 -
</pre>
83 1 chris1h1 -
84
Make sure tvheadend is not running any longer by trying to access the web ui - you should get a "not responding" style error.
85
86
Copy the new files over the existing ones (the "-i" will prompt you to make sure you want to overwrite the files that already exist at the new location. This is just to give feedback that the paths are correct):
87
88 5 chris1h1 -
<pre>
89 1 chris1h1 -
cp -i /opt/tvheadend/bin/tvheadend /usr/bin/tvheadend
90
cp -i /opt/tvheadend/share/man1/tvheadend.1 /usr/share/man1/tvheadend.1
91 5 chris1h1 -
</pre>
92 1 chris1h1 -
93
Run tvheadend with no username or password prompt, in order to set these credentials from within the web ui:
94
95 5 chris1h1 -
<pre>
96 1 chris1h1 -
cd /usr/bin
97
./tvheadend -C
98 5 chris1h1 -
</pre>
99 1 chris1h1 -
100
Go to the web ui and set an admin username and password in the "Configuration > Access Control" area. Confirm that you're now running a version from SVN by visiting the "About" tab.
101
102
Restart the computer. Since the executable is at the same path and has the same name, the existing script in /etc/init.d/ should start tvheadend upon boot (assuming you're using a recent version of XBMC Live).
103
104 5 chris1h1 -
Note: If XBMC starts up with just a small grey error message in the middle of the screen complaining about [[OpenGL]], issue the following command and say "yes" to everything once it finishes the long download stage:
105 1 chris1h1 -
106 5 chris1h1 -
<pre>
107 1 chris1h1 -
sudo nvidia-installer --update
108 5 chris1h1 -
</pre>
109 2 chris1h1 -
110 1 chris1h1 -
Add a video source in XBMC that looks like this (assuming XBMC and tvheadend are running on the same computer):
111 2 chris1h1 -
112 5 chris1h1 -
<pre>
113 1 chris1h1 -
<source>
114
  <name>Live TV</name>
115 2 chris1h1 -
  <path>htsp://username:[email protected]:9982</path>
116
</source>
117 5 chris1h1 -
</pre>
118 2 chris1h1 -
119
For XML TV listings I created a free account at http://tvlistings.zap2it.com, then followed the instructions at http://zap2xml.110mb.com/ to use their perl script to create an XMLTV file. With the XBMC Live distribution there were several libraries missing from perl - every time I tried to run the script, I'd get a message like "Can't locate HTML/Parser.pm in @INC". To fix this, do the following:
120
121
Go to /usr/bin since this is where perl lives:
122
123 5 chris1h1 -
<pre>
124 2 chris1h1 -
cd /usr/bin
125 5 chris1h1 -
</pre>
126 2 chris1h1 -
127
Go into the perl CLI:
128
129 5 chris1h1 -
<pre>
130 2 chris1h1 -
perl -MCPAN -e shell
131 5 chris1h1 -
</pre>
132 2 chris1h1 -
133
Search for whatever the error message was talking about:
134
135 5 chris1h1 -
<pre>
136 2 chris1h1 -
i /HTML::Parser/
137 5 chris1h1 -
</pre>
138 2 chris1h1 -
139
or
140
141 5 chris1h1 -
<pre>
142 2 chris1h1 -
i /HTML::Cookies/
143 5 chris1h1 -
</pre>
144 2 chris1h1 -
145
etc. Once you've found a likely candidate, install it:
146
147 5 chris1h1 -
<pre>
148 2 chris1h1 -
install HTML::Parser
149 5 chris1h1 -
</pre>
150 2 chris1h1 -
151 3 chris1h1 -
Repeat this for each missing item that perl complains about when you try to run the zap2xml script. To make tvheadend work with your XMLTV file, download the bash script from http://code.google.com/p/tv-grab-file/, edit the path on line 7 to point to wherever your file is, then put the "tv_grab_file" in /usr/bin. Make it executable:
152
153 5 chris1h1 -
<pre>
154 3 chris1h1 -
cd /usr/bin
155
chmod +x tv_grab_file
156 5 chris1h1 -
</pre>
157 3 chris1h1 -
158 4 chris1h1 -
Refresh the tvheadend web ui and when you go to the XML-TV tab you'll be able to select this source. All you have to do now is run the original perl script as a cron job. See here for help with that: http://www.csgnetwork.com/crongen.html. I put mine in the root cron table as it complained about permissions otherwise:
159
160 5 chris1h1 -
<pre>
161 4 chris1h1 -
sudo crontab -e
162 5 chris1h1 -
</pre>
163 3 chris1h1 -
164
As a final thought, you might want to remove "deb http://www.lonelycoder.com/debian/ hts main" from your sources list to prevent any future "sudo apt-get upgrade" from overwriting all the good work you've done above.