Changing IPTV links -> need to (automatically) change mux URLs
Added by Tobi Habich almost 3 years ago
Hi All
This is my first post here, so please be gentle.
I'm new to TVH but I guess I can call myself an FFMEPEG expert - anyway...
What I need is the possibility to change URLs of Muxes.
I know that there are ways to do so. One example suggesting this works is for instance here: https://github.com/lcapriotti/watchWilmaa
I totally fail in calling any script from any mux.
As a kind of simple example:
1. Having a mux configured with
URL: "pipe:///usr/bin/ffmpeg -i https://mcdn.daserste.de/daserste/de/master.m3u8 -c:v copy -c:a copy -strict experimental -metadata service_provider=IPTV -metadata service_name=Sendername_ohne_Leerzeichen -f mpegts pipe:1"
perfectly fine delivers me the livestream of "das erste".
2. Putting this same thing in an sh file does not work.
2a. I created an sh file called DasErste.sh and put it in /home/hts/.hts/.
DasErste.sh looks like this:
"
#!/bin/bash
ffmpeg -i https://mcdn.daserste.de/daserste/de/master.m3u8 -c:v copy -c:a copy -strict experimental -metadata service_provider=IPTV -metadata service_name=Sendername_ohne_Leerzeichen -f mpegts pipe:1
"
2b. As URL for the mux I think I need to use: pipe:///home/hts/.hts/DasErste.sh I tried this (and probably more than 300 slightly changed calls) without success.
It results in a scan failure. Result is TID:65536 and scan result is fail. Checking "Ignore TSID" does not help. Placing the SH file in other directories does not help either.
Can anyone share an example of how to call an SH script from a MUX ?
Thank you in advance,
Tobi
PS: I'd love to share TVH logs but i can't find them - if you let me know where these are stored I'm of course happy to share...
Replies (2)
RE: Changing IPTV links -> need to (automatically) change mux URLs - Added by Shane Meagher almost 3 years ago
Hi Tobi,
Can't help with using a script as I've never tried it that way. The more common way I see Muxes being added from a file is to use an M3U file in a Network.
Then TVHeadend will add each line as a Mux, execute the line itself is it starts with pipe:// and receive the piped output from the command. You can even specify information that TVHeadend should use for the Mux such as Name, Logo, EPG XML url, channel groups, etc in the m3u file.
Here is an example from https://github.com/PrinzMichiDE/free-epg-germany/blob/main/iptv/pipe/pipe_tv_local.m3u
#EXTM3U
#EXTINF:-1 tvg-name="a.tv" tvg-id="a.tv.de" group-title="IPTV-DE" tvg-logo="https://raw.githubusercontent.com/PrinzMichiDE/free-epg-germany/main/logos/tv/atv.png",a.tv
pipe://ffmpeg -loglevel fatal -i https://augsburgtv.iptv-playoutcenter.de/augsburgtv/augsburgtv.stream_1/playlist.m3u8 -vcodec copy -acodec copy -metadata service_name=a.tv -metadata service_provider=IPTV-DE -mpegts_service_type advanced_codec_digital_hdtv -f mpegts pipe:1
You can then edit the m3u file to change the URL to be called by the Mux. When adding the Network, you can say how often ("Re-fetch period
") TVHeadend should check the playlist for changes so while it isn't instant, you could have it check as often as you like. It will update the Muxes with the changes that it finds.
Hope this is helpful,
Shane
RE: Changing IPTV links -> need to (automatically) change mux URLs - Added by Hiro Protagonist almost 3 years ago
Can anyone share an example of how to call an SH script from a MUX ?
You could do it by following the pattern in your original post:
pipe:///path/to/script.sh script args pipe:1The caveats are:
- Make sure the script is executable
- Make sure the script is pipeable [i.e takes input on stdin and outputs on stdout]
That said, I think you're actually trying to solve the problem of a video URL that uses a redirection.
You might find a tool called 'streamlink' useful.
Make sure you have python 3 and the streamlink version is 2.0 or higher.
pipe:///path/to/streamlink --stdout --hls-live-edge 6 --ringbuffer-size 32M -4 --default-stream 720p,best --url https://mcdn.daserste.de/daserste/de/master.m3u8
I've just tried this here & it works fine from the other side of the world.