forked from rofafor/vdr-plugin-iptv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
243 lines (195 loc) · 11.9 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
This is an IPTV plugin for the Video Disk Recorder (VDR).
Written by: Rolf Ahrenberg
< R o l f . A h r e n b e r g @ s c i . f i >
Antti Seppälä
< a . s e p p a l a @ g m a i l . c o m >
Project's homepage: http://www.saunalahti.fi/~rahrenbe/vdr/iptv/
Latest version available at: http://www.saunalahti.fi/~rahrenbe/vdr/iptv/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
See the file COPYING for more information.
Requirements:
- Libcurl - the multiprotocol file transfer library
http://curl.haxx.se/libcurl/
- yt-dlp - optional. Used for protocol M3U.
Description:
This plugin integrates multicast IPTV transport streams seamlessly into
VDR. You can use any IPTV channel like any other normal DVB channel for
live viewing, recording, etc. The plugin also features full section
filtering capabilities which allow for example EIT information to be
extracted from the incoming stream.
Currently the IPTV plugin has direct support for both multicast UDP/RTP
and unicast HTTP MPEG1/2, H.264 and H.265 transport streams. Also a file
input method is supported, but a file delay must be selected individually
to prevent VDR's transfer buffer over/underflow. Therefore the file input
should be considered as a testing feature only.
IPTV plugin also features a support for external streaming applications.
With proper helper applications and configuration IPTV plugin is able to
display not only MPEG1/2, H.264 and H.265 transport streams but also other
formats like MP3 radio streams, mms video streams and so on.
Installation:
tar -xzf /put/your/path/here/vdr-iptv-X.Y.Z.tgz
make -C iptv-X.Y.Z install
Setup menu:
- Protocol base port = 4321 Defines base port used in CURL/EXT
protocol. Two ports are defined for
each device.
The port range is defined by the number
of IPTV devices times two (max. 32).
Valid range: 0...65503
- Use section filtering = 1 Defines whether section filtering shall
be used.
Valid range: 0...1
- Disable filters = 0 Certain section filters might cause some
unwanted behaviour to VDR such as time
being falsely synchronized etc. This
option allows creation of blacklists of
ill-behaving filters. If this option is
set to a non-zero value, the menu page
will contain that many "Disable filter"
options which allow you to disable the
individual section filters.
Valid range: 0...7
- [Blue:Info] Opens IPTV information/statistics menu.
Information menu:
- [Red:General] Opens the general information page.
- [Green:Pids] Opens the pid statistics page.
- [Yellow:Filters] Opens the section filter statistics page.
- [Blue:Bits/bytes] Toggles between bits and bytes mode.
Plugin parameters:
-d <num>, --devices=<number> number of devices to be created
-t <mode>, --trace=<mode> set the tracing mode
-s <num>, --thread-queue-size=<number> set the FFmpeg thread-queue-size
-y <path>, --ytdlp=<path> set the path to yt-dlp. Default /usr/local/bin/yt-dlp
Configuration:
- channels.conf
TV8;IPTV:70:S=1|P=0|F=M3U|U=other.cfg|A=2|Y=1|H=F:I:0:200:201,202,203,204,205:0:0:11:1:100:0
ST1:IPTV:90:S=1|P=0|F=STREAM|U=http%3A//locahost/stream?id=10|A=1|H=V:I:0:514:670:2321:0:5:0:200:0
RD1:IPTV:80:S=1|P=0|F=RADIO|U=http%3A//wdr-1live-live.icecast.wdr.de/wdr/1live/live/mp3/128/stream.mp3|A=8:I:0:270:271,272,273,274,275:0:0:8:1:9:8
TV7;IPTV:70:S=1|P=0|F=M3U|U=list1.cfg|A=5:I:0:200:201,202,203,204,205:0:0:11:1:100:0
TV6;IPTV:60:S=1|P=0|F=EXT|U=iptvstream.sh|A=0:I:0:0:680:0:0:6:0:0:0
TV7;IPTV:60:S=1|P=0|F=EXTT|U=iptvstreamtcp.sh|A=0:I:0:0:680:0:0:6:0:0:0
TV5;IPTV:50:S=0|P=1|F=FILE|U=/video/stream.ts|A=5:I:0:514:670:2321:0:5:0:0:0
TV4;IPTV:40:S=0|P=1|F=HTTP|U=127.0.0.1/TS/2|A=3000:I:0:513:660:2321:0:4:0:0:0
TV3;IPTV:30:S=1|P=0|F=CURL|U=http%3A//foo%[email protected]%3A3000/TS/2|A=0:I:0:512:650:2321:0:3:0:0:0
TV2;IPTV:20:S=1|P=0|F=UDP|[email protected]|A=1234:I:0:512:650:2321:0:2:0:0:0
TV1;IPTV:10:S=1|P=0|F=UDP|U=127.0.0.1|A=1234:I:0:512:650:2321:0:1:0:0:0
^ ^ ^ ^ ^ ^ ^
| | | | | | |
| | | | | | Source type ("I")
| | | | | Stream parameter
| | | | | UDP: multicast port
| | | | | CURL: <<to be defined>>
| | | | | HTTP: HTTP port number
| | | | | FILE: file delay (ms)
| | | | | EXT: script parameter
| | | | | EXTT: script parameter
| | | | | M3U: Y=1 uses yt-dlp to determine the video URL
| | | | | Y=2 tries to find the video URL internally
| | | | | H=F uses ffmpeg
| | | | | H=V uses vlc
| | | | | M3US:
| | | | | STREAM: H=F uses ffmpeg
| | | | | H=V uses vlc
| | | | | H=E calls the script iptv-cmdline-expert.py to get the commandline
| | | | | RADIO: H=F uses ffmpeg
| | | | | H=V uses vlc
| | | | | H=E calls the script iptv-cmdline-expert.py to get the commandline
| | | | Stream address
| | | | UDP: multicast [source@]group address
| | | | CURL: HTTP/HTTPS URL; colons (%3A) and pipes (%7C) shall be URL encoded
| | | | HTTP: URL; missing the scheme name part and possible port declaration
| | | | FILE: file location
| | | | EXT: script location (uses UDP)
| | | | EXTT: script location (uses TCP)
| | | | M3U: m3u playlist
| | | | M3US: m3u URL
| | | | RADIO: An URL for a radio stream
| | | | STREAM: An URL for a video stream
| | | | YT: URL (e.g. youtube or any other which is support by yt-dlp)
| | | Stream protocol ("UDP", "CURL", "HTTP", "FILE", "EXT", "EXTT", "M3U", "M3US", "RADIO", "STREAM", "YT")
| | Pid scanner ("0" disable, "1" enable)
| Section id (Sid/Nid/Tid) scanner ("0" disable, "1" enable)
Unique enumeration
- UDP multicast rules for iptables firewall
# Multicast UDP packets
iptables -A INPUT -i eth0 -p udp -d 224.0.0.0/4 --dport 1234 -j ACCEPT
# IGMP required by multicasts
iptables -A INPUT -i eth0 -p igmp -d 224.0.0.0/4 -j ACCEPT
# Default routing for multicast
route add -net 224.0.0.0 netmask 224.0.0.0 eth0
External streaming:
- To watch an externally received channel add an EXT entry to channels.conf
and specify a script name and parameter. The specified script is executed
from plugin resource directory when VDR tunes to the channel. The specified
script parameter is passed to the script and it can be used to select for
example between different URLs.
- When an EXT or CURL/RTSP channel is opened the IPTV plugin opens an UDP
listening port on the localhost. The external script is responsible for
supplying IPTV plugin with MPEG2 TS data in UDP/RTP format to the listening
port. The data will be processed in VDR like a normal DVB broadcast. The
listening base port can be specified in the plugin configuration menu.
- When an EXTT channel is opened the IPTV plugin opens an TCP
listening port on the localhost. The external script is responsible for
supplying IPTV plugin with MPEG2 TS data in TCP format to the listening
port. The data will be processed in VDR like a normal DVB broadcast. The
listening base port can be specified in the plugin configuration menu.
- Each IPTV device has different listen port. The port number is specified
as a base port number plus IPTV device index minus one. Maximum of 8 IPTV
devices can be used simultaneously.
- IPTV plugin includes an example script which uses VLC media player for
receiving streams, transcoding and handing the result to IPTV plugin.
- M3U needs additional configuration
Sample from above:
U=list1.cfg The configuration file (located in plugin directory) contains
a list of URL in the format "5:https://URL". Where 5 is the
programm number within the file (must be unique) and the URL points
to an m3u8 URL.
A=5 Plays the channel with ID 5 (see above)
VPID = 200 (select a unique one for a transponder TID)
APID = 201,202,203,204,205 (select unique ones for a transponder TID)
TPID = 0 (currently not supported, need to find a live stream with Teletext)
CAID = 0 (0 is a good value)
SID = 11 (select a unique one for a transponder TID)
NID = 1 (doesn't matter, but must be set)
TID = 100 Select a transponder.
RID = 0 (Radio only 1)
It is possible to use parameter Y=1 to use yt-dlp to determine the m3u8 URL.
Useful e.g. for youtube videos. Needs yt-dlp.
Notes:
- Working EIT requires correct Nid/Tid/Sid values as the NIT filter cannot
determine the type (satellite/cable/terrestrial) of the IPTV transport
stream.
- The following section filters are recommended to be disabled:
"NIT (0x40)", "SDT (0x42)", "TDT (0x70)"
- The IPTV devices look for a "/tmp/vdr-iptv<devicenumber>.dvr" fifo at
startup. If the fifo is found and succesfully opened, the device writes
the current data stream into it. This can be used for debugging purposes.
- Multiple channels with identical service id should have frequency
difference of 4 or greater. It's recommended to use frequencies in decades
(10, 20, 30, 40, ...) for all IPTV channel entries.
- VLC processes won't get killed on some setups with the provided iptvstream.sh
script and the iptvstream-notrap.sh script should be used instead in these
cases.
- If received MPEG-2 TS streams carry CA descriptors, you'll have to apply
"disable_ca_updates" patch to the VDR in order to get rid of "Channel not
available" messages.
- EIT scanning functionality is disabled by default.
- Section id and pid scanners should be disabled after the correct data is
found. This can be made via VDR's channel editor.
- Source-specific multicast (SSM) can be enabled by defining both the source
address and the group address separated by a '@' character. This will use
IGMP v3 protocol:
"U=<source address>@<group address>"
- The CURL implementation supports only RTSP/HTTP/HTTPS protocols and an
optional netrc configuration file for authentication:
$(CONFDIR)/iptv/netrc
- You can quite easily figure out correct DVB triplet values by using the
multicat and dvbsnoop tools:
$ multicat -u -d 1620000000 @127.0.0.1:1234 /tmp/video.ts
$ dvbsnoop -s ts -if /tmp/video.ts -tssubdecode -hexdumpbuffer 0x12 | \
grep -m1 -A8 Service_ID | grep _ID
Acknowledgements:
- The IPTV section filtering code is derived from Linux kernel.
- The pid scanning code is derived from Udo Richter's streamplayer plugin.