IPTV adding channels
Added by Poul Kalff almost 5 years ago
Hi Guys,
So, Danish national TV has moved 6 of their channels to IPTV, and I have tried to add these to TVHeadend, but it is not QUITE working, and I need help to understand why..... Here is the m3u8 file contents, I have found the file on a Danish 3. part website, which, alas, does not contain instructions on using the file. When adding the file, I have followed different tutorials here on tvheadend.org; added a network, add mux and paste an URL to the file into the mux. The mux scans OK, but yields only one service, called service01, which is useless. What have I done wrong?
#EXTM3U
#EXTINF:-1 tvg-chno="0" tvg-id="dr-k" tvg-name="dr-k" tvg-logo="logo" group-title="DR IPTV"
http://dr04-lh.akamaihd.net/i/live/dr04_0@147057/master.m3u8?b=100-4000
#EXTINF:-1 tvg-chno="1" tvg-id="dr-ultra" tvg-name="dr-ultra" tvg-logo="logo" group-title="DR IPTV"
http://dr06-lh.akamaihd.net/i/live/dr06_0@147059/master.m3u8?b=100-4000
#EXTINF:-1 tvg-chno="2" tvg-id="dr3" tvg-name="dr3" tvg-logo="logo" group-title="DR IPTV"
http://dr03-lh.akamaihd.net/i/live/dr03_0@147056/master.m3u8?b=300-5000
#EXTINF:-1 tvg-chno="3" tvg-id="dr1" tvg-name="dr1" tvg-logo="logo" group-title="DR IPTV"
http://dr01-lh.akamaihd.net/i/live/dr01_0@147054/master.m3u8?b=100-4000
#EXTINF:-1 tvg-chno="4" tvg-id="dr2" tvg-name="dr2" tvg-logo="logo" group-title="DR IPTV"
http://dr02-lh.akamaihd.net/i/live/dr02_0@147055/master.m3u8?b=100-4000
#EXTINF:-1 tvg-chno="5" tvg-id="dr-ramasjang" tvg-name="dr-ramasjang" tvg-logo="logo" group-title="DR IPTV"
http://dr05-lh.akamaihd.net/i/live/dr05_0@147058/master.m3u8?b=100-5000
Replies (12)
RE: IPTV adding channels - Added by Hiro Protagonist almost 5 years ago
The URLs in this file access .m3u8 files. In order to be useful to TVH, you need access to transport streams. Try updating these entries to pipe via ffmpeg:
pipe:///usr/bin/ffmpeg -loglevel fatal -headers User-Agent:Chrome/51.0.2704.64\ Safari/537.36\r\n -fflags +genpts -i 'http://dr04-lh.akamaihd.net/i/live/dr04_0@147057/master.m3u8?b=100-4000' -map 0 -copy_unknown -c copy -metadata service_name=dr-k -f mpegts pipe:1
Make sure the path specified is where ffmpeg is actually located.
RE: IPTV adding channels - Added by Poul Kalff almost 5 years ago
Thank you very much for your reply, Hiro.
I have rewritten the file and will try it as soon as I get home from work:
$ which ffmpeg
/usr/bin/ffmpeg
#EXTM3U
#EXTINF:-1 tvg-chno="0" tvg-id="dr-k" tvg-name="dr-k" tvg-logo="logo" group-title="DR IPTV"
pipe:///usr/bin/ffmpeg -loglevel fatal -headers User-Agent:Chrome/51.0.2704.64\ Safari/537.36\r\n -fflags +genpts -i 'http://dr04-lh.akamaihd.net/i/live/dr04_0@147057/master.m3u8?b=100-4000' -map 0 -copy_unknown -c copy -metadata service_name=dr-k -f mpegts pipe:1
#EXTINF:-1 tvg-chno="1" tvg-id="dr-ultra" tvg-name="dr-ultra" tvg-logo="logo" group-title="DR IPTV"
pipe:///usr/bin/ffmpeg -loglevel fatal -headers User-Agent:Chrome/51.0.2704.64\ Safari/537.36\r\n -fflags +genpts -i 'http://dr06-lh.akamaihd.net/i/live/dr06_0@147059/master.m3u8?b=100-4000' -map 0 -copy_unknown -c copy -metadata service_name=dr-ultra -f mpegts pipe:1
#EXTINF:-1 tvg-chno="2" tvg-id="dr3" tvg-name="dr3" tvg-logo="logo" group-title="DR IPTV"
pipe:///usr/bin/ffmpeg -loglevel fatal -headers User-Agent:Chrome/51.0.2704.64\ Safari/537.36\r\n -fflags +genpts -i 'http://dr03-lh.akamaihd.net/i/live/dr03_0@147056/master.m3u8?b=300-5000' -map 0 -copy_unknown -c copy -metadata service_name=dr3 -f mpegts pipe:1
#EXTINF:-1 tvg-chno="3" tvg-id="dr1" tvg-name="dr1" tvg-logo="logo" group-title="DR IPTV"
pipe:///usr/bin/ffmpeg -loglevel fatal -headers User-Agent:Chrome/51.0.2704.64\ Safari/537.36\r\n -fflags +genpts -i 'http://dr01-lh.akamaihd.net/i/live/dr01_0@147054/master.m3u8?b=100-4000' -map 0 -copy_unknown -c copy -metadata service_name=dr1 -f mpegts pipe:1
#EXTINF:-1 tvg-chno="4" tvg-id="dr2" tvg-name="dr2" tvg-logo="logo" group-title="DR IPTV"
pipe:///usr/bin/ffmpeg -loglevel fatal -headers User-Agent:Chrome/51.0.2704.64\ Safari/537.36\r\n -fflags +genpts -i 'http://dr02-lh.akamaihd.net/i/live/dr02_0@147055/master.m3u8?b=100-4000' -map 0 -copy_unknown -c copy -metadata service_name=dr2 -f mpegts pipe:1
#EXTINF:-1 tvg-chno="5" tvg-id="dr-ramasjang" tvg-name="dr-ramasjang" tvg-logo="logo" group-title="DR IPTV"
pipe:///usr/bin/ffmpeg -loglevel fatal -headers User-Agent:Chrome/51.0.2704.64\ Safari/537.36\r\n -fflags +genpts -i 'http://dr05-lh.akamaihd.net/i/live/dr05_0@147058/master.m3u8?b=100-5000' -map 0 -copy_unknown -c copy -metadata service_name=dr-ramasjang -f mpegts pipe:1
RE: IPTV adding channels - Added by Poul Kalff almost 5 years ago
Hiro Protagonist, I hope you can help me once more:
Unfortunately, the file scan fails. The log file says:
2020-01-15 13:17:55.797 [ ERROR]:iptv: m3u url invalid 'pipe:///usr/bin/ffmpeg -loglevel fatal -headers User-Agent:Chrome/51.0.2704.64\ Safari/537.36\r\n -fflags +genpts -i 'http://dr04-lh.akamaihd.net/i/live/dr04_0@147057/master.m3u8?b=100-4000' -map 0 -copy_unknown -c copy -metadata service_name=dr-k -f mpegts pipe:1
2020-01-15 13:18:10.795 [ INFO]:mpegts: http://185.127.48.84/drtv.m3u8 in drtv - scan no data, failed
This would suggest to me that the URL itself ('http://dr04-lh.akamaihd.net/i/live/dr04_0@147057/master.m3u8?b=100-4000') is wrong, but once again, it plays perfectly well in VLC.
I have tried, and will continue to test with different switches to ffmpeg, but is there some better way to test what is invalid in the string?
RE: IPTV adding channels - Added by Hiro Protagonist almost 5 years ago
You might have to play around a bit.
The .m3u8 files in the URLs seem to contain a large number of audio & video streams, but you can pick out the ones you want with -map.
Read the docs on -map in ffmpeg & try it out on the commandline. I was able to get it to work with:
ffmpeg -fflags +genpts -i 'http://dr02-lh.akamaihd.net/i/live/dr02_0@147055/master.m3u8?b=100-4000' -copy_unknown -c copy -map 0:0 -map 0:1 -metadata service_name=dr2 -f mpegts test.ts
Note that I've dropped the -headers User-Agent:blah\ blah parameter [some services need User-Agent, this one seems to work without] and changed from -map 0 to -map 0:0 -map 0:1.
I suggest you download the .m3u8 files [try wget http://dr04-lh.akamaihd.net/i/live/dr04_0@147057/master.m3u8] and see if you can work out which streams you want, alter the map parameters to suit and try it out like I've shown. Once you have something that works on the commandline, you should be able to drop it into your .m3u8 file [but without the test.ts on the end].
When you run ffmpeg it will show a bunch of output while it's trying to open & analyse the streams, eventually you'll see something like this:
Input #0, hls,applehttp, from 'http://dr02-lh.akamaihd.net/i/live/dr02_0@147055/master.m3u8?b=100-4000':
Duration: N/A, start: 23730.943667, bitrate: N/A
Program 0
Metadata:
variant_bitrate : 363000
Stream #0:0: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 480x270 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
Metadata:
variant_bitrate : 363000
Stream #0:1: Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
Metadata:
variant_bitrate : 363000
Stream #0:2: Data: timed_id3 (ID3 / 0x20334449)
Metadata:
variant_bitrate : 363000
Program 1
Metadata:
variant_bitrate : 363000
Stream #0:3: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 480x270 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
Metadata:
variant_bitrate : 363000
Stream #0:4: Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
Metadata:
variant_bitrate : 363000
Stream #0:5: Data: timed_id3 (ID3 / 0x20334449)
Metadata:
variant_bitrate : 363000
... and so on
The 'Stream #x:y' lines tell you what you'll need in the -map parameters for that particular program, so my example above picks out the 1st video 0:0 and 1st audio 0:1 streams. In reality you'd probably want to try Program 4 or 5 for better resolution.
RE: IPTV adding channels - Added by Poul Kalff almost 5 years ago
Thank you so much for taking the time to help me and write such a thorough explanation.
I will continue to experiment with ffmpeg and I'm sure I'll get it to work
RE: IPTV adding channels - Added by requa3r0 searchandyouwillfind over 4 years ago
HI
I am also trying to add the Danish national TV channels to Tvheaded, and also need the proper m3u file with mpeg ts stream links
can you please paste the result of your research.
I would be most thankful
Requaero
RE: IPTV adding channels - Added by Poul Kalff over 4 years ago
Hey. I did not entirely succeed, since I figured out that I didn't really need the channels, but I did get far enough to be able to add channels. Here is my file:
klf@homeworld:/mnt/6tb_hdd/www/main$ cat drtv.m3u8
#EXTM3U
#EXTINF:-1 tvg-chno="3" tvg-id="dr1" tvg-name="dr1" tvg-logo="logo" group-title="DR IPTV"
http://dr01-lh.akamaihd.net/i/live/dr01_0@147054/master.m3u8?b=100-4000
#EXTINF:-1 tvg-chno="4" tvg-id="dr2" tvg-name="dr2" tvg-logo="logo" group-title="DR IPTV"
http://dr02-lh.akamaihd.net/i/live/dr02_0@147055/master.m3u8?b=100-4000
#EXTINF:-1 tvg-chno="5" tvg-id="dr-ramasjang" tvg-name="dr-ramasjang" tvg-logo="logo" group-title="DR IPTV"
http://dr05-lh.akamaihd.net/i/live/dr05_0@147058/master.m3u8?b=100-5000
There are only three channels there, but obviously it it the same procedure for all other channels.
Adding the file through the tvheadend interface is not easy, and I don't quite rememeber the procedure, but it was easy enough to find guides on the internet
Spørg bare igen hvis der er noget....
RE: IPTV adding channels - Added by requa3r0 searchandyouwillfind over 4 years ago
using file:///var/lib/hts/.xmltv/dr.m3u
with this data
#EXTM3U
#EXTINF:-1 tvg-id="DR1.dk" tvg-name="DR1 HD DK DIRECT" tvg-logo="https://cdn-static.ams3.cdn.digitaloceanspaces.com/picons/dr1.png" group-title="Live: Denmark",DR1 HD DK
http://dr01-lh.akamaihd.net/i/live/dr01_0@147054/master.m3u8?b=100-10000
#EXTINF:-1 tvg-id="DR2.dk" tvg-name="DR2 FHD DK DIRECT" tvg-logo="https://cdn-static.ams3.cdn.digitaloceanspaces.com/picons/dr2.png" group-title="Live: Denmark",DR2 FHD DK
http://dr02-lh.akamaihd.net/i/live/dr02_0@147055/master.m3u8?b=100-10000
#EXTINF:-1 tvg-id="DRRamasjang.dk" tvg-name="DR Ramasjang DK DIRECT" tvg-logo="https://cdn-static.ams3.cdn.digitaloceanspaces.com/picons/drramasjang.png" group-title="Live: Denmark",DR Ramasjang DK
http://dr05-lh.akamaihd.net/i/live/dr05_0@147058/master.m3u8?b=100-10000
it seems to work , but im getting a really low bitrate ;O/
When adding this link into EMBY as an M3U-tuner, and set bitrate to max
https://dr01-lh.akamaihd.net/i/live/dr01_0@147054/index_3000_av-p.m3u8
I get full HD stream
I get
How do i find the correct stream to use for TVHeadend to get the same/best possible bitrate?
I have tried all kind of combinations of above pipe examples, and nothing seems to work.
I have not been able to get a single pipe link to work using below construct.
pipe:///usr/bin/ffmpeg -i <INSERT M3U8 URL HERE> -c copy -f mpegts pipe:1
dr-HD-Emby.jpg (29.8 KB) dr-HD-Emby.jpg |
RE: IPTV adding channels - Added by Hiro Protagonist over 4 years ago
requa3r0 searchandyouwillfind wrote:
it seems to work , but im getting a really low bitrate ;O/
You need to analyse the stream from the .m3u8 using ffmpeg as noted above, and select the stream you want using the appropriate -map arguments.
I have not been able to get a single pipe link to work using below construct.
pipe:///usr/bin/ffmpeg -i <INSERT M3U8 URL HERE> -c copy -f mpegts pipe:1
Make sure you put the URL inside single quotes.
RE: IPTV adding channels - Added by Poul Kalff over 4 years ago
If you open the files, for instanc http://dr05-lh.akamaihd.net/i/live/dr05_0@147058/master.m3u8 in a text editor, you'll see it contains many streams:
#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=363000,RESOLUTION=480x270,CODECS="avc1.42001e, mp4a.40.2"
http://dr05-lh.akamaihd.net/i/live/dr05_0@147058/index_300_av-p.m3u8?sd=10&dw=40&b=100-10000&set-akamai-hls-revision=custom&rebase=on
#EXT-X-STREAM-INF:BANDWIDTH=363000,RESOLUTION=480x270,CODECS="avc1.42001e, mp4a.40.2"
http://dr05-lh.akamaihd.net/i/live/dr05_0@147058/index_300_av-b.m3u8?sd=10&dw=40&b=100-10000&set-akamai-hls-revision=custom&rebase=on
#EXT-X-STREAM-INF:BANDWIDTH=928000,RESOLUTION=640x360,CODECS="avc1.4d001f, mp4a.40.2"
http://dr05-lh.akamaihd.net/i/live/dr05_0@147058/index_800_av-p.m3u8?sd=10&dw=40&b=100-10000&set-akamai-hls-revision=custom&rebase=on
#EXT-X-STREAM-INF:BANDWIDTH=928000,RESOLUTION=640x360,CODECS="avc1.4d001f, mp4a.40.2"
http://dr05-lh.akamaihd.net/i/live/dr05_0@147058/index_800_av-b.m3u8?sd=10&dw=40&b=100-10000&set-akamai-hls-revision=custom&rebase=on
#EXT-X-STREAM-INF:BANDWIDTH=1227000,RESOLUTION=768x432,CODECS="avc1.4d001f, mp4a.40.2"
http://dr05-lh.akamaihd.net/i/live/dr05_0@147058/index_1100_av-p.m3u8?sd=10&dw=40&b=100-10000&set-akamai-hls-revision=custom&rebase=on
#EXT-X-STREAM-INF:BANDWIDTH=1227000,RESOLUTION=768x432,CODECS="avc1.4d001f, mp4a.40.2"
http://dr05-lh.akamaihd.net/i/live/dr05_0@147058/index_1100_av-b.m3u8?sd=10&dw=40&b=100-10000&set-akamai-hls-revision=custom&rebase=on
#EXT-X-STREAM-INF:BANDWIDTH=1827000,RESOLUTION=1024x576,CODECS="avc1.4d001f, mp4a.40.2"
http://dr05-lh.akamaihd.net/i/live/dr05_0@147058/index_1700_av-p.m3u8?sd=10&dw=40&b=100-10000&set-akamai-hls-revision=custom&rebase=on
#EXT-X-STREAM-INF:BANDWIDTH=1827000,RESOLUTION=1024x576,CODECS="avc1.4d001f, mp4a.40.2"
http://dr05-lh.akamaihd.net/i/live/dr05_0@147058/index_1700_av-b.m3u8?sd=10&dw=40&b=100-10000&set-akamai-hls-revision=custom&rebase=on
#EXT-X-STREAM-INF:BANDWIDTH=3128000,RESOLUTION=1280x720,CODECS="avc1.640029, mp4a.40.2"
http://dr05-lh.akamaihd.net/i/live/dr05_0@147058/index_3000_av-p.m3u8?sd=10&dw=40&b=100-10000&set-akamai-hls-revision=custom&rebase=on
#EXT-X-STREAM-INF:BANDWIDTH=3128000,RESOLUTION=1280x720,CODECS="avc1.640029, mp4a.40.2"
http://dr05-lh.akamaihd.net/i/live/dr05_0@147058/index_3000_av-b.m3u8?sd=10&dw=40&b=100-10000&set-akamai-hls-revision=custom&rebase=on
RE: IPTV adding channels - Added by Poul Kalff over 4 years ago
What I did was open these in vlc and look at tools->media info, to look at the streams
RE: IPTV adding channels - Added by requa3r0 searchandyouwillfind over 4 years ago
Thanks I have already tried this. Its works just fine.
I got this result
#EXTM3U
#EXTINF:-1 tvg-id="DR1.dk" tvg-name="DR1 HD DK DIRECT" tvg-logo="https://cdn-static.ams3.cdn.digitaloceanspaces.com/picons/dr1.png" group-title="Live: Denmark",DR1 HD DK
http://dr01-lh.akamaihd.net/i/live/dr01_0@147054/index_3000_av-p.m3u8?sd=10&dw=40&rebase=on
#EXTINF:-1 tvg-id="DR2.dk" tvg-name="DR2 FHD DK DIRECT" tvg-logo="https://cdn-static.ams3.cdn.digitaloceanspaces.com/picons/dr2.png" group-title="Live: Denmark",DR2 FHD DK
http://dr02-lh.akamaihd.net/i/live/dr02_0@147055/index_3000_av-p.m3u8?sd=10&dw=40&b=100-10000&set-akamai-hls-revision=custom&rebase=on
#EXTINF:-1 tvg-id="DRRamasjang.dk" tvg-name="DR Ramasjang DK DIRECT" tvg-logo="https://cdn-static.ams3.cdn.digitaloceanspaces.com/picons/drramasjang.png" group-title="Live: Denmark",DR Ramasjang DK
http://dr05-lh.akamaihd.net/i/live/dr05_0@147058/index_3000_av-p.m3u8?sd=10&dw=40&b=100-10000&set-akamai-hls-revision=custom&rebase=on
BUT....Its not better that the first result i posted.
I am getting a bitrate of 3 Mbits/s ish 720p
I what hoping to tab into a popper HD signal, but can not find it.
I'm wondering if the bitrate reported by EMBY is actually correct.
Does anyone have any idea if I can find a better stream?
Requaero