How to broadcast video stream on a LAN in real-time?

Ryuu picture Ryuu · Mar 25, 2015 · Viewed 68.5k times · Source

I'm trying to establish a system capable of broadcasting the screen capture of a pc to several other pcs on a LAN.

So far I managed to install nginx on a Raspberry Pi with the rtmp module and I can stream using the Raspberry as a RTMP Server via OBS. I use VLC to watch the stream.

Here is the problem. The main pc doing the broadcast will be displaying a timer that counts down and potentially camera feeds so it would be ideal to keep the broadcast delay to a minimum (real time?). I currently have a 4-6 seconds delay between what is happening on the screen and the stream and am looking for ways to further reduce it.

  • Is there a way to determine how much of that delay time is due to encoding and how much of it is due to transfer?
  • I am currently capturing at 1080p30 and tried options such as downscaling and minimize network impact to no avail.
  • I read other topics concerning LAN broadcast on this forum and someone did mention that RTMP wasn't a good approach...If so what would be a better approach?
  • Any suggestions are welcome and appreciated. I am mostly interested in free solutions as I have no budget and doing this for free for someone else.
  • I also did look into VLC streaming but I don't want to show the whole screen of the pc as there would be controls that the viewers don't have to see. And the only thing VLC can do about it is to specify which part of the screen to broadcast which doesn't seem like a great solution. I chose OBS because it's the only free broadcasting software that can broadcast a specific window to my knowledge.

Thanks in advance :)

Answer

thomas picture thomas · Mar 25, 2015

First I think you are right to use OBS, it's a great project allowing you to capture a lot of things.

If you want to optimize the video speed there are many ways you can try :

  • The first one is to use another RTMP client, VLC is good but it uses too much cache, try this one for example (just set the right rtmp url, clear the NetGroup input and connect),
  • Then you can try another server, I wrote the following tutorial on How to set up your own RTMFP server using MonaServer,
  • And finally you can modify your OBS parameters (I use the "Twitch" parameters which are optimized for real-time).

For me with OBS+MonaServer+my VideoPlayer I have a delay of 2 seconds, that's not real-time but that's already better.

Last thing, OBS is known to add latency on RTMP sessions, I know that it is possible to improve it by modifying the source code of OBS but here it's a little bit tricky...

I hope it will help you! Contact me if you need more informations.