catalinii / minisatip

minisatip is an SATIP server for linux using local DVB-S2, DVB-C, DVB-T or ATSC cards
https://minisatip.org
328 stars 81 forks source link

SAT>IP over long distance WAN with relay #1073

Closed Delitants closed 1 year ago

Delitants commented 1 year ago

Hi, I'm looking the way to establish SAT>IP connection over long distance WAN and I would need to have some sort of relay or proxy in the middle to buffer, due to very high latency. Is it possible?

Point A (minisatip server) -> Intermediate point B (here minisatip should receive, buffer and pass further) -> Point C (minisatip client)

Jalle19 commented 1 year ago

If you connect two instances with TCP it works well even over longer links, have you tried that?

Delitants commented 1 year ago

If you connect two instances with TCP it works well even over longer links, have you tried that?

What's that means? How?

lars18th commented 1 year ago

Hi,

If you connect two instances with TCP it works well even over longer links, have you tried that?

Even this seems to work, is not reliable. I don't recommend it at all except for some basic testing. The TCP mode for RTSP has only sense with networks like wifi that can lost paquets. But in any case in local LANs (or networks with very small latency). The main problem is that the current implementation of RTSP-over-TCP has not specific strategies for contention when the stream bitrate raises the effective transport bandwith. Only with a guaranteed bandwith higher than the bitrate that can generate the minisatip server this transport will work without troubles.

Therefore, for use it in the open Internet, I recommend to use an specialized proxy. At time, I don't know about any specific for the SAT>IP protocol. And for this reason I've some ideas for a future implementation. Anyway not integrated in minisatip, so it will be an standalone SAT>IP remote proxy.

I hope it helps.

lars18th commented 1 year ago

Hi @Delitants ,

What's that means? How?

From the README:

-O --satip-tcp Use RTSP over TCP instead of UDP for data transport

Therefore, if your SAT>IP remote server connected to the antenna is a minisatip instance (or any other with RTSP-over-TCP), then you only need to start your local minisatip adding the option -O. With this it will connect with the remote indicated with the param -s --satip-servers using the TCP transport instead of UDP.

Jalle19 commented 1 year ago

Could be interesting to add SRT support to minisatip (https://www.haivision.com/products/srt-secure-reliable-transport/)

lars18th commented 1 year ago

Could be interesting to add SRT support to minisatip (https://www.haivision.com/products/srt-secure-reliable-transport/)

That's one of my ideas. But I feel it could be difficult to achieve it. What you think @catalinii ?

catalinii commented 1 year ago

I use minisatip over long latency WAN. The setup (currently) is: minisatip A (using DVB cards) -> VPS using xinetd port forwarding (~ 20-40ms away) -> minisatip B (180ms away from vps) -> tvh, enigma2, ...

The reason I use VPS is that the bandwidth from minisatip A to B is small, but I found few local VPs providers where the bandwidth from A to the VPS is high.

To give you a sense of speed:

In case of not enough bandwidth generally the data is buffered on the server side (minisatip A) until it overflows when packet loss/image artifacts happens. In severe cases the connection is reset when minisatip re-establishes the connection.

I used UDP also when the connection is good and the advantage is that I see picture faster (smaller latency) using UDP vs TCP (tcp has something called slow start).

I have a specific network setup (sysctl snd tcp congestion algo modification on minisatip B) but that's about it

We can try SRT if you guys have experience with it...

lars18th commented 1 year ago

Hi @catalinii ,

My satipc use is in-home only. However, I've do some tests with something similar to you, and the results are not good. The main reason is when the bandwitdh varies a lot and some packets are lost. Anyway, please could you share with us the sysctl custom configuration?

We can try SRT if you guys have experience with it...

I've do a lot tests in the past. And this protocol is rock-solid. If you want to include it inside the minisatip it could be simple to achieve it: the RTP channel can go through the SRT connection without much effort. Therefore you only need to modify the satipc module.

Regards.

catalinii commented 1 year ago

I am using this:


# cat /etc/sysctl.con
net.core.wmem_max=12582912
net.core.rmem_max=12582912
net.ipv4.tcp_rmem= 10240 87380 12582912
net.ipv4.tcp_wmem= 10240 87380 12582912
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1

# head -20 /etc/rc.local
#!/bin/bash

modprobe tcp_scalable
echo "scalable" > /proc/sys/net/ipv4/tcp_congestion_control
catalinii commented 1 year ago

It is expected to loose packets, of course you can always increase the buffer sizes (using -B, eg -B 100 - which is 100MB)... but if the BW is not sufficient at some point the buffer will be full and overflow.

Delitants commented 1 year ago

Thanks, I'll give it a try.

catalinii commented 1 year ago

@lars18th I tried using srt-live-stransmit to connect 2 instances of minisatip but do not see any improvements: server A:

./minisatip -l http -f -r localhost

On a separate console:

./srt-live-transmit udp://127.0.0.1:6500 srt://serverB:1234

On server B:

./minisatip -s serverA -l http
srt-live-transmit srt://0.0.0.0:1234?mode=listener udp://serverB:6500
Jalle19 commented 1 year ago

I'm guessing SRT would perhaps bring improvements only for bad links, not ones where UDP or TCP would otherwise work good enough.

catalinii commented 1 year ago

I don't feel it behaves better than TCP for my use case, but if you guys can test you can see if it worths for your use case.

Jalle19 commented 1 year ago

Closing this since there's nothing actionable here

Delitants commented 1 year ago

I was able to get a stable stream using RTSP over TCP.