Tvheadend NTSC » History » Version 6
Adam Sutton, 2012-08-23 10:11
1 | 1 | chris1h1 - | h2. Analogue NTSC with HTS-Tvheadend |
---|---|---|---|
2 | 5 | chris1h1 - | |
3 | 6 | Adam Sutton | NOTE: This is very out of date! |
4 | 5 | chris1h1 - | |
5 | 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. |
6 | |||
7 | First, make sure you have the packages installed that are required to build tvheadend: |
||
8 | |||
9 | 5 | chris1h1 - | <pre> |
10 | 1 | chris1h1 - | sudo aptitude install build-essential libavahi-client-dev subversion |
11 | 5 | chris1h1 - | </pre> |
12 | 1 | chris1h1 - | |
13 | Now create the following directory. This is where we'll download the source code to and eventually build the application: |
||
14 | |||
15 | 5 | chris1h1 - | <pre> |
16 | 1 | chris1h1 - | mkdir -p /opt/tvheadend/src |
17 | 5 | chris1h1 - | </pre> |
18 | 1 | chris1h1 - | |
19 | Now you need to check out the Tvheadend source code using svn: |
||
20 | |||
21 | 5 | chris1h1 - | <pre> |
22 | 1 | chris1h1 - | svn co svn://svn.lonelycoder.com/hts/trunk/tvheadend /opt/tvheadend/src/ |
23 | 5 | chris1h1 - | </pre> |
24 | 1 | chris1h1 - | |
25 | We need to make a small edit to a file to switch analogue support from PAL to NTSC: |
||
26 | |||
27 | 5 | chris1h1 - | <pre> |
28 | 1 | chris1h1 - | cd /opt/tvheadend/src/src |
29 | nano v4l.c |
||
30 | 5 | chris1h1 - | </pre> |
31 | 1 | chris1h1 - | |
32 | Press Cntl + W to perform a search in this file. Search for the following: |
||
33 | |||
34 | 5 | chris1h1 - | <pre> |
35 | 1 | chris1h1 - | v4l2_std_id |
36 | 5 | chris1h1 - | </pre> |
37 | 1 | chris1h1 - | |
38 | Change: |
||
39 | |||
40 | 5 | chris1h1 - | <pre> |
41 | 1 | chris1h1 - | v4l2_std_id std = 0xff; |
42 | 5 | chris1h1 - | </pre> |
43 | 1 | chris1h1 - | |
44 | To: |
||
45 | |||
46 | 5 | chris1h1 - | <pre> |
47 | 1 | chris1h1 - | v4l2_std_id std = V4L2_STD_NTSC; |
48 | 5 | chris1h1 - | </pre> |
49 | 1 | chris1h1 - | |
50 | Cntl + X to close, Y to save, Enter/Return to save with the existing file name. |
||
51 | |||
52 | Run the configuration script: |
||
53 | |||
54 | 5 | chris1h1 - | <pre> |
55 | 1 | chris1h1 - | cd .. |
56 | ./configure --prefix=/opt/tvheadend --release |
||
57 | 5 | chris1h1 - | </pre> |
58 | 1 | chris1h1 - | |
59 | If all went well you can compile the Tvheadend source code: |
||
60 | |||
61 | 5 | chris1h1 - | <pre> |
62 | 1 | chris1h1 - | make |
63 | 5 | chris1h1 - | </pre> |
64 | 1 | chris1h1 - | |
65 | If the source is compiled with no errors you can install the compiled source: |
||
66 | |||
67 | 5 | chris1h1 - | <pre> |
68 | 1 | chris1h1 - | make install |
69 | 5 | chris1h1 - | </pre> |
70 | 1 | chris1h1 - | |
71 | 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: |
||
72 | |||
73 | 5 | chris1h1 - | <pre> |
74 | 1 | chris1h1 - | ps aux | grep tvheadend |
75 | 5 | chris1h1 - | </pre> |
76 | 1 | chris1h1 - | |
77 | The PID is the first number, after "hts". Kill it (replace PID with the actual number from the previous command): |
||
78 | |||
79 | 5 | chris1h1 - | <pre> |
80 | 1 | chris1h1 - | sudo kill PID |
81 | 5 | chris1h1 - | </pre> |
82 | 1 | chris1h1 - | |
83 | Make sure tvheadend is not running any longer by trying to access the web ui - you should get a "not responding" style error. |
||
84 | |||
85 | 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): |
||
86 | |||
87 | 5 | chris1h1 - | <pre> |
88 | 1 | chris1h1 - | cp -i /opt/tvheadend/bin/tvheadend /usr/bin/tvheadend |
89 | cp -i /opt/tvheadend/share/man1/tvheadend.1 /usr/share/man1/tvheadend.1 |
||
90 | 5 | chris1h1 - | </pre> |
91 | 1 | chris1h1 - | |
92 | Run tvheadend with no username or password prompt, in order to set these credentials from within the web ui: |
||
93 | |||
94 | 5 | chris1h1 - | <pre> |
95 | 1 | chris1h1 - | cd /usr/bin |
96 | ./tvheadend -C |
||
97 | 5 | chris1h1 - | </pre> |
98 | 1 | chris1h1 - | |
99 | 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. |
||
100 | |||
101 | 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). |
||
102 | |||
103 | 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: |
104 | 1 | chris1h1 - | |
105 | 5 | chris1h1 - | <pre> |
106 | 1 | chris1h1 - | sudo nvidia-installer --update |
107 | 5 | chris1h1 - | </pre> |
108 | 2 | chris1h1 - | |
109 | 1 | chris1h1 - | Add a video source in XBMC that looks like this (assuming XBMC and tvheadend are running on the same computer): |
110 | 2 | chris1h1 - | |
111 | 5 | chris1h1 - | <pre> |
112 | 1 | chris1h1 - | <source> |
113 | <name>Live TV</name> |
||
114 | 2 | chris1h1 - | <path>htsp://username:[email protected]:9982</path> |
115 | </source> |
||
116 | 5 | chris1h1 - | </pre> |
117 | 2 | chris1h1 - | |
118 | 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: |
||
119 | |||
120 | Go to /usr/bin since this is where perl lives: |
||
121 | |||
122 | 5 | chris1h1 - | <pre> |
123 | 2 | chris1h1 - | cd /usr/bin |
124 | 5 | chris1h1 - | </pre> |
125 | 2 | chris1h1 - | |
126 | Go into the perl CLI: |
||
127 | |||
128 | 5 | chris1h1 - | <pre> |
129 | 2 | chris1h1 - | perl -MCPAN -e shell |
130 | 5 | chris1h1 - | </pre> |
131 | 2 | chris1h1 - | |
132 | Search for whatever the error message was talking about: |
||
133 | |||
134 | 5 | chris1h1 - | <pre> |
135 | 2 | chris1h1 - | i /HTML::Parser/ |
136 | 5 | chris1h1 - | </pre> |
137 | 2 | chris1h1 - | |
138 | or |
||
139 | |||
140 | 5 | chris1h1 - | <pre> |
141 | 2 | chris1h1 - | i /HTML::Cookies/ |
142 | 5 | chris1h1 - | </pre> |
143 | 2 | chris1h1 - | |
144 | etc. Once you've found a likely candidate, install it: |
||
145 | |||
146 | 5 | chris1h1 - | <pre> |
147 | 2 | chris1h1 - | install HTML::Parser |
148 | 5 | chris1h1 - | </pre> |
149 | 2 | chris1h1 - | |
150 | 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: |
151 | |||
152 | 5 | chris1h1 - | <pre> |
153 | 3 | chris1h1 - | cd /usr/bin |
154 | chmod +x tv_grab_file |
||
155 | 5 | chris1h1 - | </pre> |
156 | 3 | chris1h1 - | |
157 | 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: |
158 | |||
159 | 5 | chris1h1 - | <pre> |
160 | 4 | chris1h1 - | sudo crontab -e |
161 | 5 | chris1h1 - | </pre> |
162 | 3 | chris1h1 - | |
163 | 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. |