Best way to securely stream videos from a remote server?

I’m currently running OSMC on a raspberry pi 4. I have osmc using sshfs to mount a drive on a remote server so that I can securely stream remote content from that server. It works so far and is able to see all my media which is great. I can also start watching content from the server. The issue I keep seeing and this doesn’t happen all the time but is happening more and more it feels is that I constantly have the play stop and a buffering dialog apear. There is plenty of bandwidth, my server on a multihomed 20gbit network. The destination is a cable internet ISP where I can download at 100+ mbit with very low latency. My osmc client is connected via wifi though but it feels like this is not the problem since again my speed tests on my wifi is 50mbit+

Any idea what the problem could be? I’m wondering if it’s possibly SSHFS for some reason. Is there a better solution? I had originally setup wireguard and NFS but really didn’t like this approach since there is no authentication with NFS and does not allow binding to the internal wireguard IP only.

I think a good way is to use a protocol that’s made to work well with high latency, like WebDav. Traditional file transfer protocols like SMB become very slow once the latency increases like it does on a remote connection.

Personally I use WireGuard or TailScale to connect devices, then I play directly from a WebDav share. With this it can easily play UHD rips on my 500mbit connection.

Since the connection is encrypted by WireGuard I don’t even use secure WebDav.

Ideally OSMC would have a TailScale client but we’re not there yet. To work around that I have installed TailScale on both routers to connect devices on the whole subnet.

One other factor to take into account is also the encryption overhead.
Log into the raspberry PI and check the CPU load while streaming a Movie (a good one with high MBps).

From experience, best so far is NFS over Wireguard (In terms of resources and speed) if the CPU on both devices are able to handle the load.

50mbit works out to roughly around 6Mbytes/s (50/8) minus overhead from the network protocol and any bandwidth sharing with other devices on the wifi. The not-so-hi-q 1080p videos I play from paramount+ are in the 3M/s bitrate range, so it wouldn’t take much to saturate a 50mbit connection. Playing something like an actual 1080p bluray rip would likely be in the 10-20Mb/s range depending on quality. What are the bitrates of the videos you are trying to play?

a 802.11ac wifi network can get up to 200mbit on a single channel, so you might be able to do something to improve the wifi depending on how saturated your environment is.

I’d suggest running an ethernet cable between your Pi and router to rule out the wifi before tackling the protocol question.

Also check the cpu usage when streaming. possibly the encryption could be putting a strain on the Pi.

Other possible options would include setting up a VPN tunnel between your router and remote server (to offload the encryption from the Pi) and letting the pi use plain nfs.