Receive srt stream within OBS

celesti

New Member
As written in below wiki link, there are two ways to receive srt stream within OBS. One the them, "If however the stream is received straight from an encoder in caller mode, add the mode=listener to the URL (see screenshot)." Do it mean, I have to install and launch OBS Studio on encoder module or on srt server?
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Receive srt stream within OBS

This could be useful to two pc setups (although NDI is probably a more common solution).
In a Media Source, uncheck 'Local File'.
For 'Input', enter the srt URL. If the stream is received from a server (in listemer mode), the srt connexion will be in mode=caller (which is the default one so the option can be omitted). If however the stream is received straight from an encoder in caller mode, add the mode=listener to the URL (see screenshot).
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 

danma06

New Member
I don't think OBS will open the port on the local machine to actually act as a receiver.

Unless I'm missing something.
 

danma06

New Member
I'm looking into this some more.

I'm wondering if the Ubuntu OBS is missing SRT support.

According to what I am finding, you should be able to create a Media Source in OBS and set the Input to

srt://%ip%:5000?listener

and that should open up an SRT listener on port 5000.

But when you do this, the OBS log shows:

warning: MP: Failed to open media: 'srt://%ip%:5000?listener'

I'm not sure how OBS is suppose to be accomplishing this.

There's no mention of any srt libraries in /usr/lib/obs-plugins/obs-ffmpeg.so or for that matter, any of the libraries in /usr/lib/obs-plugins

ldd /usr/lib/obs-plugins/* | grep srt

This is with OBS:

OBS Studio - 25.0.8 (linux)
 

Aporiac

New Member
Your connection string is not quite right. Should be: -

'srt://%ip:%port%?mode-listener'

That works on Mac version anyway, and I don't see why it should be different on Ubuntu as it uses the same FFmpeg libraries.

I've had problems with SRT connections closing when the SRT Media Source is inactive (i.e. not in the current live scene). I've found a combination of Media Source settings for SRT that seem robust to Larix Broadcaster stopping and restarting, the source becoming inactive and then active again, and OBS being shut down and restarted. In each case, the iOS 'camera' comes back on-line without having to fiddle with anything. Here is a screen grab: -

Screenshot 2020-10-22 at 22.10.23.png


The 0 MB buffer gives the minimum (<2s) latency and doesn't seem to cause any problems.
 

Aporiac

New Member
The text should read:-

''srt://%ip:%port%?mode=listener' (as per the screen-grab)


Your connection string is not quite right. Should be: -

'srt://%ip:%port%?mode-listener'

That works on Mac version anyway, and I don't see why it should be different on Ubuntu as it uses the same FFmpeg libraries.

I've had problems with SRT connections closing when the SRT Media Source is inactive (i.e. not in the current live scene). I've found a combination of Media Source settings for SRT that seem robust to Larix Broadcaster stopping and restarting, the source becoming inactive and then active again, and OBS being shut down and restarted. In each case, the iOS 'camera' comes back on-line without having to fiddle with anything. Here is a screen grab: -

View attachment 62344

The 0 MB buffer gives the minimum (<2s) latency and doesn't seem to cause any problems.
 

nottooloud

Member

nottooloud

Member
The 0 MB buffer gives the minimum (<2s) latency and doesn't seem to cause any problems.

Something's wrong there. I don't think OBS is respecting the latency settings. Sending 2 streams from one phone to vMix and OBS running on the same computer, with Broadcaster's latency set to what Larix says is the minimum, 120ms, vMix set to the same, and OBS set to 0 buffers, I get ~ .5 sec on vMix and 2 sec on OBS. Same if I add &latency=(various numbers) to the OBS line, as per the ffmpeg docs. You should be able to set the latency at either end, and the longer setting wins.
 

tnxS32cYPE6Q

New Member
I'm using Larix on Android phone as source of 1080p video, which works for few minutes until I get error
[mpegts @ 0x7c8c04000be0] PES packet size mismatch
[mpegts @ 0x7c8c04000be0] Packet corrupt (stream = 0, dts = 986388).
[mpegts @ 0x7c8c04000be0] PES packet size mismatch
[mpegts @ 0x7c8c04000be0] Packet corrupt (stream = 0, dts = 989385).
[mpegts @ 0x7c8c04000be0] PES packet size mismatch
[mpegts @ 0x7c8c04000be0] Packet corrupt (stream = 0, dts = 998381).
It is possible there is something wrong with phone or Wifi connection. Phone is in the same room as Wifi router.
 

Ajlevitt

New Member
I use www.dvcloud.tv to pull multiple SRT sources into OBS and stream SRT out to YouTube, FB Live etc. No need to worry about ports or firewalls and you can do point to multipoint.
 

jjensenlcn

New Member
I'm goofing up someplace. Removed stock ffmpeg, recompiled with srt, installed OBS, connected two other cams video0 and rtmp then tried SRT and got a big nope.
No matter what port I try I get this:
MP: Failed to open media: 'srt://192.168.1.9:9000?mode=listener'


SRT appears to be there.
ffmpeg -protocols |grep srt
ffmpeg version n4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --enable-libsrt --enable-libx264 --enable-libx265 --enable-gpl --enable-gnutls --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-nonfree
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
srtp
srt
srtp
srt

Saw someone saying OBS doesn't open ports on its own.
Sooo I opened up ports for UDP in the firewall and got the same thing:
MP: Failed to open media: 'srt://192.168.1.9:9000?mode=listener'

Appears I'm missing something along the way but not sure which way to turn next.

Anybody else solve this yet?
 

danma06

New Member
There's a post at:


that was really helpful in compiling OBS and FFMPEG with SRT support.

I'm just really not sure if the pre-compiled Linux OBS is compiled with SRT support.

Make sure your OBS installation is linking with libsrt

$ ldd $(which obs) | grep libsrt

This should return something that shows it being linked to libsrt.

Having said all of this... using SRT didn't solve the issue/concern that I had. I was wanting to use two cameras (two cell phones with Larix Broadcaster) to send an SRT stream to OBS and have them in synch. But I could not get them to synch up. One camera was always a couple of seconds behind the other. I seem to remember reading another post/article where someone was seeing the same out of synch behavior with OBS but not with another broadcasting software (I can't find the link). So if the intent is to synch up multiple SRT cameras in OBS, this may be an inherent issue within OBS.

For my project I kind of abandoned using multiple cameras - it was going to be a bit too complex anyway - so, while it's still something that bugs me, it's not something that I'm really actively working towards a resolution.
 

ethaniel

Member
The simple solution is to add the gstreamer module to obs and then create a gstreamer source with the following config:
Code:
srtsrc uri="srt://192.168.86.249:7001?mode=listener" ! decodebin name=bin ! queue ! video. bin. ! queue ! audio.
 

danma06

New Member
The simple solution is to add the gstreamer module to obs and then create a gstreamer source with the following config:
Code:
srtsrc uri="srt://192.168.86.249:7001?mode=listener" ! decodebin name=bin ! queue ! video. bin. ! queue ! audio.

Many thanks for this! This does appear to solve my multi camera synching issue - at least in a simple test.

First I'd heard of the gstreamer plugin and gstreamer in general. Like I said, I'd kind of abandoned the multi camera setup anyway, so I guess I hadn't really looked that hard.

Thanks again!
 

danma06

New Member
I've had some people ask for help with getting the GStreamer plugin working in OBS on Linux. I'm not really sure what application people are using this for and may be entirely different from mine, but I'll give what I did to try and help.

What I'm doing is using multiple Android phones (although I guess they could be iPhones) and using the Larix Broadcaster app. I'm connecting these phones and the box running OBS onto the same LAN network. The multiple Android phones will provide different video feeds into OBS and from best I can tell, the video between the multiple devices is synchronized. Note: when I say multiple, I'm only referring to two devices - I assume it would scale upward.

I should also note that I'm not really using this setup. Originally I thought I might want to have multiple cameras setup and be able to switch angles in my broadcast. Using nginx and RTMP I was not able to get this in sync - one video was always a little bit ahead of the other, so switching between angles wasn't really feasible. So I began chasing a white rabbit to try and figure out how to accomplish this. And in the meantime I found that one single camera worked well enough. Further, trying to manage multiple cameras for my one-man production crew proved to be a bit daunting. So my desire to find a multi-camera solution turned more into a quest of "how can this be done?" instead of actually applying it in production.

The first thing you need to know is the local IP address of the box running OBS. Should be a 192.168.X.Y or 10.X.Y.Z IP address - for me, it's 192.168.0.40 - but everyone's network setup is going to be different. I'm going to refer to this as %boxip% in these instructions.

Start out by downloading the Gstreamer plugin from:


You'll want to click the Go to download button and download the obs-gstreamer.zip file.

Next, unzip the obs-gstreamer.zip file and since we're only interested in the Linux library, you can just do:

unzip obs-gstreamer.zip linux/obs-gstreamer.so

Next, you want to create the plugin path for the GStreamer plugin:

mkdir -p ~/.config/obs-studio/plugins/obs-gstreamer/bin/64bit

And finally move the obs-gstreamer.so library into this directory:

mv linux/obs-gstreamer.so ~/.config/obs-studio/plugins/obs-gstreamer/bin/64bit

The Gstreamer plugin has now been installed.

Now, start OBS and in your desired scene click the Add button and add a GStreamer Source element

In the Pipeline area for this GStreamer Source element put:

srtsrc uri="srt://%boxip%:%port%?mode=listener" ! decodebin name=bin ! queue ! video. bin. ! queue ! audio.

Here - again %boxip% refers to the local IP address of this Linux box you are running.

The %port% can really be anything - but it's important to remember what this is.

Also, if you are using multiple devices, each device is going to use a different port. So these ports identify which device the feed is coming from.

I tend to start my port numbering at 7001 - I don't know why. I think that's what someone in this thread used 7001 so that's where I got my start.

Say you have an inside recording device and an outside recording device. The inside recording device might be sending out on port 7001 and the outside recording device might be sending out on port 7002. When you create these Gstreamer Elements and set their Pipeline area, you need to know which port is being referred to by each device so you set the element correctly.

That's really about it in OBS.

On your phone or devices - I'm using Larix Broadcaster, but I'm sure other SRT broadcasters would work.

In Larix Broadcaster create a new connection - name it something that you can recognize.

Set the URL to:

srt://%boxip%:%port%

Again - %boxip% is the IP address of the Linux box running OBS

%port% is the port number referring to the specific GStreamer Source element you want this video to be seen at.

Click Save and make sure that new Connection is enabled.

Then go back to the camera screen in Larix Broadcaster and hit record.

The video from the phone should be displayed in the GStreamer Source element in OBS.

You can then create additional GStreamer Source elements and use the same Pipeline statement - just change the %port% to reflect the the different streamer device source. And setup Larix Broadcaster on other devices again specifying the different %port% to reflect this video stream.
 

doobre

New Member
Hi there All..
to ethaniel and danma06 - that info is just what I was looking for.
I have accomplished multiple android mobile phone camera sources using SRT from Larix into OBS (windows) but the sync between them is the issue. I will try the Gstreamer suggestion and pray..
Does running the Gstreamer add a large overhead on top of OBS and other components.?
thanks again.. cheers CD
 

doobre

New Member
Hi there All..
to ethaniel and danma06 - that info is just what I was looking for.
I have accomplished multiple android mobile phone camera sources using SRT from Larix into OBS (windows) but the sync between them is the issue. I will try the Gstreamer suggestion and pray..
Does running the Gstreamer add a large overhead on top of OBS and other components.?
thanks again.. cheers CD
Hi there again
I have done what I think is the windows equivilent of the above steps.. but one problem, I don't get to see the gstreamer source element option in OBS. So I figure that the gstreamer app or service is not running..
Ideas anyone..?
cheers CD
 
Top