OBS Studio OBS-Studio: Send an UDP Stream to a second PC using OBS [Deleted]

Status
Not open for further replies.

Jack0r

The Helping Squad
Jack0r submitted a new resource:

OBS-Studio: Send an UDP Stream to a second PC using OBS - The custom ffmpeg output allows us to use different output protocols, here is one example.

First we of course have to configure OBS-Studio:
obs32_2016-10-02_16-19-38.png

  • Settings -> Output -> Mode -> Advanced
    • Recording Tab -> Type -> Custom Output (FFmpeg)
    • FFmpeg Output Type -> Output to URL
    • File path or URL -> udp / rtp / rtsp / tcp ://receiver.ip.address:port
      (f.e. udp://192.168.0.5:1234)
    • Container Format -> Depends on the protocol, for udp it would be mpegts for example, make sure to select a streamable...

Read more about this resource...
 

dnb

New Member
2 reasons I can think of:
1 - RTMP has some overhead being a protocol which is a superset of UDP. IE, it has more stuff in the UDP datagram packets so you get less frames of video/audio per burst. As such, frame losses due to dropped UDP packets via RTMP are more drastic and will cause higher corruption of the stream.
2 - You don't need a server to broadcast UDP. The tutorial SHOULD have walked you through a process of setting up an output to a UDP multicast IP (i.e., udp://224.0.0.1:9999). This special subnet is capable of being sent and received on a local network. For RTMP, you need something to wrap the UDP packets with the RTMP protocol for proper slicing due to how RTMP allows seeking of previous uncached data.

Feel free to ask more questions, but I might be slow-replying.


EDIT:

I just actually read thoroughly, and he's technically doing it wrong by pointing to his own IP (or really any Class-C subnet). This sets up a SINGLE cast on UDP, which while it WILL work, will not allow multiple clients to connect to the stream.

Instead, use an IP on the multicast subnet: https://en.wikipedia.org/wiki/Multicast_address
I showed an example above.

Then when listening on other clients (i.e., vlc) use udp://@224.0.0.1:9999 (or whichever ip you choose).
 

dnb

New Member
Argh, wanted to amend my pervious post, but it's invisible until moderated...

I'd also like to state that if you want to stream to multiple RTMP servers, you will need to use an RTMP stream server.

You can use another instance of FFMPG or FFSERVER to set up streams easily.

I'd still use UDP as the source for the RTMP server for the ability of multiple clients having the ability to access a more raw stream.

UDP -> Client A
--------> Client B
--------> FFMPEG -> RTMP OUT or RTMP Server to further split (for bitrate switching)
 

Jack0r

The Helping Squad
Hey, I am always happy to improve a guide, as I did not know of the multicast feature. Will update the guide.
(I mainly created it for pc to pc communication with probably no big need for more connections, but with your idea both should work fine)
 

Tony32

Member
So how would I capture this udp stream from my encoding PC and re-encode it? (without vlc)
Should I still use RTMP to push to services? Like twitch?
Edit: On CentOS 7, no desktop environment.
 

Jack0r

The Helping Squad
We use FFmpeg for sending and it should be able to grab the udp stream as well. It can also stream directly to an rtmp server. I would probably suggest to test how reliable ffmpeg grabs and sends the stream in this case and then decide if a rtmp server is needed.
 

Lucage

New Member
So we can have this as some sort of source media without VLC in OBS? or do I have the completely wrong end of the stick?

Either way, this is great work!
 

MartijnMumbles

New Member
So this is really useful, but as you mention there's the restrictions between container format and available encoders.

It'd be very useful to open up mpegts to an mpeg4 avc encoder. Where does the limitation come from? (Seeming it's not an ffmpeg limitation). Do you know if someone is working on it?

edit: typo
 
Last edited:

Shawsoce

New Member
I'm getting very high ping spikes ingame on both PC's when using this option, what do you think could be causing this problem? Ping on my third PC is normal. I've been testing bitrates on the UDP Stream PC and it is still spiking
 

MartijnMumbles

New Member
I'm getting very high ping spikes ingame on both PC's when using this option, what do you think could be causing this problem? Ping on my third PC is normal. I've been testing bitrates on the UDP Stream PC and it is still spiking

mpeg2 is many times less efficient than mpeg4 part 10. It wouldn't shock me if it's flooding some interfaces..
 

BOLL

Member
I'm very interested in getting this to work, I filled out my settings as the screenshot in the guide, do I have to add explicit muxer/video/audio encoding settings or anything else? When I try to record I get "An unspecified error occurred while recording."

I figured multicasting might be disabled on my router, an Asus AC66U, so I enabled Multicast forwarding IGMP Snooping on both LAN and Wireless and also Multicast routing IGMP Proxy, basically anything that mentioned multicast but OBS still throws the same undefined error.
 

MIB

New Member
Hi,

Big Thanks! for this post, it works great with OSX, The only issue I can find is that there is no option I can find to set the TTL which I guess is set to Zero, I have solved this for my purpose by using VLC to locally receive the upd stream and re-stream via a different udp address with a TTL set which gets it to where I want.

Is there a TTL setting or can one be added ?

Thanks again!
 

Boildown

Active Member
Hi,

Big Thanks! for this post, it works great with OSX, The only issue I can find is that there is no option I can find to set the TTL which I guess is set to Zero, I have solved this for my purpose by using VLC to locally receive the upd stream and re-stream via a different udp address with a TTL set which gets it to where I want.

Is there a TTL setting or can one be added ?

Thanks again!

From https://ffmpeg.org/ffmpeg-protocols.html

Looks like you can simply put in a custom command saying ttl=x , where x is whatever you want the TTL to be.
 

MIB

New Member
From https://ffmpeg.org/ffmpeg-protocols.html

Looks like you can simply put in a custom command saying ttl=x , where x is whatever you want the TTL to be.

Thank you for your reply, however I have since found that it is not a TTL problem as Wireshark tells me the stream has a TTL=16 which is more than enough.

It is better if I explain the problem :- I am trying to stream directly to an Exterity IPTV Receiver (R9200) using the UDP protocol which I can make work by sheep dipping the UDP stream through VLC, this which works a treat :-) I incorrectly assumed it was a stream TTL issue as there was no setting, but it was not the problem.

I have compared the two streams OBS and routed through VLC and the main difference I can see via wire shark is as follows :-


OBS Stream [Protocols in frame: eth: ethertype: ip: udp: data]

VLC Stream [Protocols in frame: eth: ethertype: ip: udp: mp2t: mpeg-pes]


My guess is OBS is sending the video as data packets and not video, this does not seem to be a problem for VLC playback but the Exterity box does not know what to make of it, in fact it locks the box up for some time when it receives it.

Thanks again for your help.
 

xses

New Member
I have some issues setting this up. OBS setup works fine but there seems to be an issue with the output. Everytime I'm opening the stream there are huge artefacts in the stream. Didn't make a screenshot yet but the stream looks something like this picture https://i.stack.imgur.com/jAJYI.png

I tried different bitrates from 2500 - 20000 it stays the same. Maybe some problems with 120hz refreshrate?
Maybe someone could help me with this. thanks in advance.
 
Status
Not open for further replies.
Top