IPTV proxying question
Added by A M almost 3 years ago
I just installed Tvheadend and added some free IPTV channel list for testing. It works.
I would like to add IPTV provider's playlist to Tvheadend. My provider allows only 1client/1stream, which is not problem, but I want to share these streams to 3 more TV in my property (not at same time!):
I would like to achieve that if any of sub-client is watching others should be blocked from connecting (first come first serve). This way provider always see one connection/request and I am not breaking the rules.
My questions are:
- Is this somehow possible? Maybe limit max concurrent user connection / Network?
- In pass trough mode provider will see the end client IP (who is actually watching) or it sees only the Tvheadend IP? I checked with tcpdump and I think not. The route is: stream -> tvheadend -> client
- In an advanced scenario I could imagine to stream to other clients who want to watch while the server is "busy" a video with message "stream in use, try later". I could imagine a ffmpeg process which streams constantly an image with this message and this channel could be used as secondary service for IPTV channels? So when main source is busy Tvheadend should automatically jump to this second source and shows the message?
Replies (9)
RE: IPTV proxying question - Added by A M almost 3 years ago
Actually playing with the settings:
1.
[PROVIDER IPTV] DVB Inputs -> Networks -> Maximum # input streams: 1
Seem to work fine. When I am streaming in one client I am unable to connect with second client. Is it that easy?
3. For test I added a second IPTV provider and set a lower priority to it.
In DVB Inputs / Muxes I picked one channel [from PROVIDER IPTV] and set high priority to it (priority & streaming priority -I don't know which one helped).
Also I selected a failover-channel [from SECOND IPTV PROVIDER] here and set lower priority to it (priority & streaming priority)
In Channel/EPG -> Channels I chosed the channel I selected earlier [from PROVIDER IPTV] and added failover-channel [from SECOND IPTV PROVIDER]
It seem to be working. When I try to connect to it I see main channel [from PROVIDER IPTV], and failover-channel only then, when [PROVIDER IPTV] is busy (streaming).
A new question has arisen...
- how do I batch add a failover service/channel/ for all channels? Setting one by one is very time consuming
- what would be the best way to stream a still image and use as IPTV source? I tried ffmpeg -re -loop 1 -i ./image.jpg -r 1 -vcodec mpeg4 -f mpegts udp://0.0.0.0:3322, but it uses a lot of cpu.
RE: IPTV proxying question - Added by Hiro Protagonist almost 3 years ago
Are you sure this is necessary?
I have Maximum # input streams: 0 set on my IPTV channels. As far as I can tell, a second client accessing the same channel does not result in TVH opening a second input stream.
RE: IPTV proxying question - Added by A M almost 3 years ago
Good question - I haven't tested this yet-, but what if you have a IPTV channel which has unlimited access: so you can view with any number of clients at same time. In this case TVH would not allow to view more than one client?
In your case not the provider who is restricting you to open the second stream? This works, but the provider can monitor your connecting attempts -> maybe he would not happy to see this.
RE: IPTV proxying question - Added by Hiro Protagonist almost 3 years ago
From what I've seen in the logs, the mux is only opened once, and the input bandwidth does not increase if a new client starts accessing the same stream. I think the provider will not be able to tell you have more than 1 client streaming.
Maybe someone who knows TVH internals better can confirm, but to me it would seem to be very poor design to open a new input stream [broadcast or IPTV] just to serve the exact same data to a new client.
RE: IPTV proxying question - Added by saen acro almost 3 years ago
@ A M
Correct word PROXY with word RESTREAM and will be clear to all.
RE: IPTV proxying question - Added by A M almost 3 years ago
Thanks.
I made som progress today. What I am currently trying to achieve is to show a message that the stream is currently not available. As I wrote yesterday I created a short video for this (.ts format, failover.m3u) and added as new connection in Networks. Here I set low streaming priority (10) and for main IPTV channels I set high streaming priority (1000).
- The biggest problem now is that I don't know how to add second service (failover.m3u) at once. I can select all channels and edit services from there, but this overwrite service with the actual selected row for all.
- Is there any way to loop video for my failover iptv connection? Currently it is 60sec long then it stops. Maybe with some pipe:///ffmpeg magic as source input?
Any help would be appreciated.
RE: IPTV proxying question - Added by saen acro almost 3 years ago
Pipe with ffmpeg will work, add multiple streams as backup.
RE: IPTV proxying question - Added by A M almost 3 years ago
It worked.
pipe:///usr/bin/ffmpeg -stream_loop -1 -i http://192.168.1.54/failover.ts -codec copy -metadata service_name="Failover Service" -f mpegts pipe:1
The only question what is left is how to add second service to all channels at once.
I am already watching this folder and thinking to manually add secondary service id to files:
:~/docker/tvheadend/cfg/channel/config$
Isn't there a better way?
RE: IPTV proxying question - Added by saen acro almost 3 years ago
A M wrote:
It worked.
[...]
The only question what is left is how to add second service to all channels at once.
I am already watching this folder and thinking to manually add secondary service id to files:
:~/docker/tvheadend/cfg/channel/config$
Isn't there a better way?
Just add failover
pipe:///usr/bin/ffmpeg \
-i http://main.server/stream/vid.m3u8 \
-i http://backup.server/stream/vid.m3u8 \
-c:a copy -c:v copy -f mpegts pipe:1
Use native not docker processing, docker is slow.