Possible bug - OBS seem to be unable to handle incoming and outgoing rtmp streams simultaneusly

edge_lv

New Member
Morning everyone!

I tried to search for answer elsewhere without much luck so I came here, to the (hopefully) origins of OBS.

My issue is quite complicated and spread across Windows and Linux OSes as well as across OBS and NGINX. With so many parties involved and so basic IT knowledge I have - I`ve run out of options, so - please help!
Here`s a copy paste of my post in Reddit (from here)


What I`m trying to achieve is to capture multiple incoming rtmp streams and simultaneously restream another stream to FB and YT on the same machine. So far I haven`t been able to make it. All single components are working - I can pull all the incoming streams in VLC, and I can see the restreamed stream in youtube. They`re just not working together.
I`m using NGINX on old linux machine, OBS`s and RTMP camera app on my phone. This is my nginx.conf file, the rtmp part:
Code:
rtmp {

server {

listen 1935;

chunk_size 4096;



application live {

live on;

record off;

#eautosports

#push rtmp://127.0.0.1:19350/rtmp/xxxxx$

push rtmp://a.rtmp.youtube.com/live2/xxxx;

# push rtmp://live-arn.twitch.tv/app/xxxx$

#push rtmp://ingest03.cloudycdn.services/xxxxx$

}

}

server {

listen 1936;

chunk_size 4096;

application camera1 {

live on;

record off;

}

}

server {

listen 1937;

chunk_size 4096;

application camera2 {

live on;

record off;

}

}

server {

listen 1938;

chunk_size 4096;

application camera3 {

live on;

record off;

}

}

}

When I connect OBS on laptop to camera1, and phone to camera2, I can see the incoming streams in third computer, in master OBS (that creates the restreamed stream) right away. As soon as I press Start Streaming in master OBS to start the master stream, all the incoming rtmp streams crash, there`s no incoming picture in master OBS, and in source OBS in laptop error message says OBS is disconnected.
As far as understand, there`s a conflict between incoming rtmp streams, as long as one is active, no others are allowed. Meanwhile, there can be multiple incoming streams, the issue is when there`s incoming streams along with the restreamed (push) streams. I made each incoming stream to be on different port, but that seemingly made no difference.
What am I missing? It should be a piece of cake. Is there something in protocol or NGINX code that`s limiting this? In other words, is there a way around this? The easy way would be to setup another machine - one for incoming, one for restreaming, but - really?

<br>

level 6
CyberSecurityTrainee

1 point·18 days ago

Let me get the scenario down.
  1. You have your phone pushing a stream to nginx
  2. You have your laptop pushing a stream to nginx
  3. You have a PC pulling both streams into OBS
  4. This PC pushes an OBS stream to nginx
  5. nginx pushes a stream to youtube
Is that right?

<br>


level 7
edge_lv

1 point·17 days ago

Yes, you`re right. In all 5 instances the nginx is the same, on the same machine. And at the end the nginx pushes to 3 destinations, one of them is FB tunnel solution.

<br>

level 8
CyberSecurityTrainee

1 point·16 days ago

So based on what you want to happen and your nginx config you should have configured Laptop, Phone and Computer as shown.
  1. Phone pushes to rtmp://[IP]:1936/camera1
  2. Laptop pushes to rtmp://[IP]:1937/camera2
  3. Computer with OBS pulls in rtmp://[IP]:1936/camera1/live and rtmp://[IP]:1937/camera2/live
  4. Computer OBS streams to rtmp://[IP]/live
  5. NGINX pushes to twitch with push rtmp://a.rtmp.youtube.com/live2/xxxx; I can see this above.
(BTW for number 4, would maybe rename application away from live, and then stream to new rtmp://[IP]/[new_app_name], since we use live elsewhere built into nginx, just to avoid confusion.)
Can you confirm you've set up the apps to stream to these IPs and paths? If you set it up like this I would expect to work.
Also you mentioned it works if only part of it is used at once. Can you test it with all parts and only some parts. And use top bash command in nginx to test for system performance. Not sure if that would be an issue, but will check to be sure.

<br>

level 10
edge_lv

1 point·5 days ago

Thanks for the input! All the IPs and paths are correct, and I also expect it to work. However, it doesn`t. Both incoming streams start fine, but they crash as soon as I launch the outgoing one. I even changed the outgoing path of rtmp://[IP]/live port from 1935 to 1938 thinking that the default port is causing problems.
Nope, it`s all the same. It kinda works better now, I can have all three streams running but not without some reconnecting, and several "Could not access the specified stream key..." errors in OBS. I want this to be reliable as rock but for now it`s not. I wouldn`t trust this system a real live stream.
First I started both incoming streams, and after them - the outgoing one. As soon as I launch the outgoing, the incoming ones crash.
Then I started off with outgoing. When she`s live, I can launch both incoming without any errors. This sequence looks kinda better. In this case the only issue is, that OBS won`t show the live picture, I always have to guess if it`s coming in or not. When trying the other way around, the picture is usually live in Preview window.
So, in general, the question remains intact - why are incoming and outgoing streams conflicting in this setup? How can I build a non-conflicting setup with given functionality?

So, any ideas please welcome!

To add - the issue of OBS not beeing able to handle the named streams (when after several disconnects I manage to get the system working) results in heavy sound damage in the final stream (for example https://www.youtube.com/watch?v=Q0ePskvOIHI @ 9:10 - the wide shot comes from camera that was streamed into OBS via RTMP while the closeup was from LiveU, that was captured from server via HDMI - so as soon as OBS switches to incoming RTMP stream, sound goes bad). What`s really critical, that the sound damage is NOT heard in monitor headphones, it`s present only in final stream in Youtube and Facebook.

Like I said - the setup is quite complicated, so its hard for me to narrow down to the faulty part in the chain. Please help!
 

Tomasz Góral

Active Member
Why you push stream to diffrents ports number ?
In config you have only ONE port active (1935 is default port for rtmp).
Remember FB use rtmps not rtmp protocol, YT still use rtmp.
Remember to use diffrent name for streams (key name).

I have similary config with one port and working, change only key name.
Correct solution:

rtmp://IP/live/FirstCam1
rtmp://IP/live/FirstCam2
rtmp://IP/live/FirstCamX - X any number

rtmp://IP/live/OutputStream

prepare FFMPEG e.g.
ffmpeg -i rtmp://IP/live/OutputStream -c copy -f flv rtmp://ANY_SERVICES
or for FB
ffmpeg -i rtmp://IP/live/OutputStream -c copy -f flv rtmps://ANY_SERVICES

Remember to compile ffmpeg with correct protocols.
 

edge_lv

New Member
Thanks for reply! I think you didn't read it through - I've each port configured for each incoming camera.
I want to avoid ffmpeg unless there are really no other options at all.
Let me ask - in your setup is there anywhere OBS involved? I believe in output stream but how are your incoming streams made? Straight from camera?
 
Top