Streaming over LAN with local RTMP server

Kai22

New Member
(I originally posted this over on the SourceForge forums, but wanted to see if anyone else had ideas about this)

I was able to get OBS to send a stream to a rtmplite server I had setup on the local LAN, here's what I did:

- Installed python 2.7

- downloaded and extracted rtmplite

- ran rtmplite in cmd prompt -> python rtpm.py -d

- browse to http://myprojectguide.org/p/flash-videoio/6.html

(You need a webcam connected to test this next bit)

- scroll down to the 2 flash players set the left one to
rtmp://(ip-address-of-rtmplite-computer)/myapp?publish=(streamname)

- hit "set"

You should see debug messages flying up in the cmd window for rtmplite

- Set the right one to the same(only this one will play the stream):
rtmp://(ip-address-of-rtmplite-computer)/myapp?play=(streamname)

hit "set"

You should see the webcam stream in the right be a mirror of what's on the left.

- Go back to the left one and hit "reset" this will stop the stream
LEAVE THE RIGHT ONE CONNECTED, DON'T HIT "reset"

- In OBS, in Settings -> Broadcast Settings, set Streaming Service to "Custom"
- Set "Server" to rtmp://(ip-address-of-rtmplite)/myapp
- Set "play path" to (streamname) (same (streamname) you used above)
- hit Apply, OK then "Start Streaming"

You should see debug messages flying up in the cmd window for rtmplite

The stream should appear in the right flash window
-----------------------------------------------------------------------------------

Some Observations:
-----------------------------------------------------
1) The OBS stream only worked when there was a previous connection with the same
information (ip, appname and streamname) that ends with a client still connected to it.
It's as if the OBS stream is lacking certain header information that's keeping the client
from seeing it correctly. If you don't do it this way, OBS will still stream to rtmplite (you can see the debug messages), but the flash client won't be able to see the stream.

2) Once I had it working, no matter what settings I used in OBS (bitrate, buffer, quality, size, etc), I always had a solid 4 second delay from what OBS saw to the end stream in the Flash client. When connecting the left window to the right there was virtually no delay, but with the OBS stream it's like it buffered 4 seconds before it showed the stream, every time. I'm not sure if it's something in the rtmplite server, but it's more likely related to the headers that OBS sends, vs what headers are used by rtmplite to stream to other Flash clients.

Is there any way to get OBS to send the "correct" headers to a rtmp server like rtmplite?
(without breaking streaming to Twitch, etc) Being able to save a file and stream to a LAN server(with lower latency) would be awesome. The software would have applications outside of Internet streaming.

I'm setting up a videocast with a friend that uses a mix of webcams, graphics, and desktop sharing between 2 computers, and it would be awesome for both of us to be able to see the stream in (near) real-time as we perform it. It would save crazy routing of long HDMI cables snaking around the studio.
 

hilalpro

Member
i think that jim said something about having a possible server application that is ready and could be integrated within obs. i don't know much great details about this.

if 4 seconds delay is all you're getting then you can remove most of it by simply using the latest test build 0.473b. it has a negligible buffering time. check it out
 

Kai22

New Member
Confirmed! the new test build (.473b test8) lowers the delay to 1.5 seconds. I'm sure if Jim tweaks it more, it'll probably come down even more. I could also see if there is anything I can do on the rtmplite site as far as how it accepts the stream.
 

R1CH

Forum Admin
Developer
Most of the remaining delay is in the encoder, and lowering it will sacrifice quality.
 

Bensam123

Member
Unless you have basically unlimited local bandwidth (gigabit).

In the advanced options put in "tune=zerolatency". Then boost your bitrate till you have an acceptable picture.

I would be interested to know if rtmplite plays nicely with bitrates in excess of 20Mbps for lan encoding. Adobe Media Server disconnects clients (people watching the stream) with bitrates over 15-20Mbps.
 

Kai22

New Member
I actually do have Gigabit Ethernet - I will try the tune=zerolatency switch and see what that does.
 

Kai22

New Member
Yeah, that tune=zerolatency helped alot. Latency is down to 200-800 ms, definitely under a second.

I still have to do the "start a real flash stream and stop it while the client is connected then stream OBS to the same path" trick to get it to work. I can point the OBS stream to a path for rtmplite to pick up, but when a client connects to it there's no picture or sound (but you can see the stream running and the time increment). There is something that the Flash publishing client is sending that allows the viewing client to see it properly.

I'm only at 3000 bitrate right now (it looks great to me), custom buffer unchecked, CFR and CBR on. 1280x720 @30fps
I'll try a few lower settings and see if the latency is affected more.
 

dodgepong

Administrator
Forum Admin
Pjstaab said:
I've managed to get my latency down to about a second. Any more luck on lowering latency?
You're really not going to do much better than that. What are you trying to do?
 

Pjstaab

New Member
dodgepong said:
Pjstaab said:
I've managed to get my latency down to about a second. Any more luck on lowering latency?
You're really not going to do much better than that. What are you trying to do?

Just seeing if I could get latency insensitive games playable over a stream.
 

Pjstaab

New Member
Bensam123 said:
Sounds like a take on cloud gaming.
Exactly what i'm trying to do. I'd like to be able to play games elsewhere in my place without having to haul my desktop around.
 

Bensam123

Member
I'd look into Nvidia Shield if that's what you're trying to do. It would most definitely be a better solution then this.
 
How using Quick Sync for replace capture card to stream on second PC.

+ no need spend money for capture card
- add 4-5 seconds delay ( not sure )
- need intel processor with intel graphics
- cpu usage on first pc is 5-10%

So.
1) Installed python 2.7
2) downloaded and extracted rtmplite
3) download and extracted rtmpdump ( http://rtmpdump.mplayerhq.hu/ )
4) ran rtmplite in cmd prompt -> python rtpm.py -d
5) ran rtmpgw.exe -r "rtmp://127.0.0.1" --app "myapp" --playpath "game" --live
6) ran VLC player, open URL, http://127.0.0.1:80 ( use hardware decoder for low cpu usage )
7) in OBS set custom rtmp server :
rtmp://127.0.0.1/myapp
play path : game
8) start OBS streaming. Important : 6 and 7 step must be done before 8 step.
9) capture VLC player video and encode with OBS with x264 encoder.

For Quick Sync set bitrate over 10000 kbps for loseless image quality. I use 1280x1024x60fps 20000kbps, maybe it overkill, but it only test for now. Buffer size maybe have lower number for less delay or it maybe do nothing, don't know. Need more tests.

127.0.0.1 is second PC ip, it maybe 192.168.0.2 or what you set in local network for him.
All steps, except 7,8, is for second streaming PC.

If developers add some future send video over udp or http it may less delay.
 

Bensam123

Member
Some other people mentioned similar things. Problem using VLC is it locks up occasionally or doesn't have the same quality. You also have the whole issue of the play bar poping up and generally being unable to actively change the second PC at all.

I've also encountered issues with ultra high bitrates (such as 10k) with VLC and sound issues. Where if you stream for a long period of time the audio will eventually dsync. I haven't played around with this in awhile though. The same thing happens with SMPlayer.

Hopefully Jim will add a native RTMP server and be able to take in streams as a source in OBS so we can get around all of this. Still have my fingers crossed that this will happen.
 
Actually RTMP server in OBS don't needed, some http server for stream on other PC make easier.
Price 100$ for capture card not that much if some one build high end streaming PC. Maybe it don't needed actually.
 
Top