obs-gstreamer

obs-gstreamer 0.4.1

Grackis

New Member
Hello,

I have got pretty far in the setup here, I have it integrated into OBS but I am having trouble getting the Pipe line to load my cameras rtsp stream into obs. I have tried it many different ways but I always end up with a black/nothing result. Neither of these below urls are working for me via gstreamer but the rtsp link does work using VLC or obs media. Any ideas? P.S. I have tried it with and without the quotes ""


uridecodebin uri="rtsp://USER:PASS@IP_ADDRESS/cam/realmonitor?channel=4&subtype=0&unicast=true&proto=Onvif" ! queue ! video.
rtspsrc location="rtsp://USER:PASS@IP_ADDRESS/cam/realmonitor?channel=4&subtype=0&unicast=true&proto=Onvif" latency=0 buffer-mode=auto ! rtph264depay ! h264parse ! d3d11h264dec ! video.
 

Tuna

Member
Could be anything really. Verify that it works with the gst-launch1.0 command first. Maybe try rtspt:// protocol which tunnels RTP over TCP. Since you hid your ip address it may be that no UDP transmission is not possible due to NAT.
 

Grackis

New Member
Could be anything really. Verify that it works with the gst-launch1.0 command first. Maybe try rtspt:// protocol which tunnels RTP over TCP. Since you hid your ip address it may be that no UDP transmission is not possible due to NAT.

Thank you so much for the quick reply, i have tried the rtspt command as well with no luck. I am on a fully Vlanned network, however I am able to connect using the VLC or the Media Source within OBS using the...
rtsp://USER:PASSWORD@XX.XX.XX.XX/cam/realmonitor?channel=3&subtype=0&unicast=true&proto=Onvif

ok, i think you are saying use the rtspsrc command directly within the gst-launch windows through command line, not utilizing obs

The results are... "No sink-element named "(NULL)" - ommiting link
removing the "quotes" from my location gets better results...
However i notice in the below information that it has removed anything after the & symbol in my URL

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Pipeline is PREROLLED ...
Prerolled, waiting for progress to finish...
Progress: (connect) Connecting to rtsp://USERNAME:PASSWORD@IP_ADDRESS/cam/realmonitor?channel=4
Progress: (open) Retrieving server options
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Unauthorized
Additional debug info:
../gst/rtsp/gstrtspsrc.c(6652): gst_rtspsrc_send (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Unauthorized (401)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
'subtype' is not recognized as an internal or external command,
operable program or batch file.
'unicast' is not recognized as an internal or external command,
operable program or batch file.
'proto' is not recognized as an internal or external command,
operable program or batch file.
 
Last edited:

Grackis

New Member
Ok so after research on my end. The only problem I seem to be having is that Gstreamer will not allow me to input & characters into my src URL is there a way to fix this? maybe a character escape flag or something? %26 ?
 

JohnPW

New Member
Video freeze and catch-up

First thanks to others on this forum for helping me find GStreamer and to the GStreamer developer - you have provided a good low-latency solution - but I have one issue left to resolve….

Thanks to guidance here I am successfully feeding 4 IP camera RTSP streams into OBS with low latency.

My problem is that some streams, at intervals that can vary from a few seconds to many minutes, the video freezes for up to a second and then runs fast to catch up over a second or so.

The detail:-
  • Camera streams are H264 1080p 30fps, Iframe every second, 4Mbps over local wired network.
  • OBS GStreamer source pipeline is Uridecodebin uri=rtsp://streamurl name=bin ! queue ! video.
  • “Use pipeline timestamps” unticked
  • “Sync appsyncs to clock” unticked
  • Audio handled separately - but stable low latency needed to maintain lip sync
  • Win10 with i7 processor not overloaded and plenty of RAM…
Having explored the forum I’ve found many variables that might help and have tried many of them with no success. I'd really appreciate a steer! Thanks in anticipation!

Best wishes, John
 

Tuna

Member
Sounds like network congestion to me.

Could also be some weird locking timing issue inside the pipeline.. not tellable unless deep debugging/inspection.
Could also be big I-frames from the encoder side.
 
Last edited:

JohnPW

New Member
Sounds like network congestion to me.

Could also be some weird locking timing issue inside the pipeline.. not tellable unless deep debugging/inspection.
Could also be big I-frames from the encoder side.
Many thanks for the quick reaction. It shouldn't be network congestion - the ethernet network extends only from the PC, though a gigabit PoE router, to the 4 local cameras over Cat6 ethernet, longest run about 30m. Allowing for the 2nd stream from each camera there should only be around 5-6MBps per camera, 30Mbps tops... The problem is visible on the OBS preview and programme screens so is on the input side. (We are also recording at 4Mbps to SSD and streaming 1.5Mbps over a tethered mobile connection offering 20Mbps upstream but the problem is independent of whether we are recording/streaming). Processor loading is below 10% when not streaming.....

I'll try reducing the camera iFrame frequency and see if that reduces incidence of the glitch... Similarly I can try some temporary reductions to video resolution and bitrate to reduce iFrame size and indeed some increases, and see if that makes any difference...

Would you be able to offer a steer to any web pages which explain how to capture logs from the pipeline? I've found the GStreamer tutorials but must admit I find them hard to follow!
 

JohnPW

New Member
An update...

Our video "Freeze and catchup" issue was made significantly worse with camera stream rates increased form 4Mbps to 6Mbps, and significantly better with the camera stream rate reduced to 3Mbps. Changing from 1080p to 720p and a camera stream rate of 4MBps significantly reduced or eliminated the problem. So it does appear to be related to processing capacity or IFrame sizes or similar... That gives us an interim solution.

We would hope to return to using 1080p with at least 4Mbps in due course so still hope to find a proper solution. Task Manager is reporting CPU processer utilisation below 20% - but perhaps it is an occasional very short term peak capacity issue?

Is there any possibility that defining buffer sizes or setting them to be "leaky" might help? Any tips on how to get detailed information from GStreamer on what is happening would be welcome?
 
Hello JohnPW, we have a very comparable setup. We use a NVidia card to off load the CPU. Here is one of our pipelines :

rtspsrc location=rtspt://url latency=100 ! rtph264depay ! h264parse ! nvh264dec ! video.

Mind the rtspt , it means we use tcp instead of udp. Gives a lot better stability in our setup. Please let us know if this helps you !
 
o and by the way, to check if the camera's themselves are working ok, we use ONVIF device manager, an open source project very handsome to tackle IP camera issues. If your camera's are ONVIF compliant, this could help you to pinpoint your problem. We run about 4 camera's on a 100MB POE switch with no network problems at all, so your gigabit should be up to the job.
 

JohnPW

New Member
Johnny_bravo - many thanks for the feedback. We don't have a graphics card but could add one if it is going to be a solution... We will try some variants on your pipeline and see if it helps.
 

fripster

New Member
Tuna, you are a lifesaver! We are were using OBS with RTSP camera's under Debian via VLC stream, but Debian has taken the RTSP functionality away in the newest versions of VLC because of non-free code in the VLC plugin. This meant that RTSP was not usable anymore under Debian with OBS!
Now with your plugin we have access to RTSP again! Many, Many thanks for this!!!
 

jonvalt

New Member
Hey man. I just wanted to come on here (in fact I had to register an account just to post this) to THANK YOU for these step by step instructions. I'm running OBS on an old iMac, and have been searching the frozen stream thing for awhile now with no luck. THANK YOU AGAIN.

Anyone reading - this absolutely works. Modify the url to match your camera. In my case, it was:

uridecodebin uri=rtsp://name:password@ip:554 name=bin ! queue ! video. bin. ! queue ! audio. <---- that period is part of the command!

(If anyone is interested, look for WoodlandsSquirrelCam on Twitch. I won't link to it because I don't want to spam. It's just a camera aimed at a squirrel feeder - nothing fancy)

It seems like a few people have made this work on a Mac but none of them have really shared how exactly. What little is out there says Macport but then doesn't really say how or what. There is a prebuilt but then people say that doesn't work.

After much trial and mostly error. I did finally make it work with the prebuilt. I had to create a symbolic link from the gstream libraries to where the prebuilt thinks they are. Probably easiest to do from a terminal window.

  1. Download GStream and install. https://gstreamer.freedesktop.org/download/#macos
    I used 1.18.3 runtime installer. It probably won't let you install it and you'll have to go to System Preferences => Security General tab and allow it to install.
  2. Get the prebuilt: https://github.com/fzwoch/obs-gstreamer/releases/tag/v0.3.0 (or whatever the latest version is) download obs-gstreamer.zip and expand
  3. From the terminal window logged in as an administrator create directories needed for the plugin in obs (obs-gstreamer and bin)
    sudo mkdir -p /Library/Application\ Support/obs-studio/plugins/obs-gstreamer/bin
  4. Copy obs.gstreamer.so from expanded directory in step 2. (obs-gstreamer/macos). If you downloaded it and expanded it in your download directory then from the terminal
    sudo cp ~/Downloads/obs-gstreamer/macos/obs-gstreamer.so /Library/Application\ Support/obs-studio/plugins/obs-gstreamer/bin
  5. Create directories and symlink from gstream libraries to where the plugin is expecting them
    sudo mkdir -p /opt/local
    sudo ln -s /Library/Frameworks/GStreamer.framework/Versions/1.0/lib /opt/local/
  6. Open OBS. You may get a message about obs-gstreamer.so not being OK. Cancel. Quit OBS go to System Preferences => Security General tab and allow it. Open OBS again. Now you should see GStreamer Source in the sources.
  7. Add a GStreamer Source. Uncheck both Sync options. Put in a pipeline. For us using PTZOptics camera without audio (we have a separate mixer), it was this:
    uridecodebin uri=rtsp://192.168.2.88/1 name=bin ! queue ! video.
Good luck. It seems like it shouldn't this hard. I guess is someone were to rebuild the .so with what the current GStream pkg installs into and create the directories above the .so so it can just be plopped in the pluggin directory...
 

JohnPW

New Member
Hello JohnPW, we have a very comparable setup. We use a NVidia card to off load the CPU. Here is one of our pipelines :

rtspsrc location=rtspt://url latency=100 ! rtph264depay ! h264parse ! nvh264dec ! video.

Mind the rtspt , it means we use tcp instead of udp. Gives a lot better stability in our setup. Please let us know if this helps you !
Johny Bravo many thanks for sharing your pipeline code... Prompted by your suggestion we have changed to using a similar code which is
rtspsrc location=rtspt://url latency=100 ! rtph264depay ! h264parse ! video.
The same as yours but without the video clause as we don't have a graphics card...
As a result we have been able to return to full 1080p, with 4 IP cameras feeding at 6Mbps, recording at 1080p 4Mbps and streaming at 720p 2.5Mbps (limited by broadband network speed), all without a graphics card on an i7 processor. This has eliminated our "freeze and catchup" video problem. Using TCP instead of UDP for the camera feeds is a little counter-intuitive but it works! Thank you!
 

JohnInStockie

New Member
Hi Guys,

I am having trouble installing GStreamer on Windows 10, can someone please help me see what I am doing wrong?

- I have dropped the file 'obs-gstreamer.dll' in the "C:\Program Files\obs-studio\obs-plugins\64bit" folder

- I have downloaded "gstreamer-1.0-mingw-x86_64-1.18.4.msi" and this auto installed in "D:\gstreamer\1.0\mingw_x86_64\bin". It also updated the env variables adding "GSTREAMER_1_0_ROOT_MINGW_X86_64" as "D:\gstreamer\1.0\mingw_x86_64\"

Yet when I start OBS nothing happens and the logs says this:-
"18:27:02.121: LoadLibrary failed for '../../obs-plugins/64bit/obs-gstreamer.dll': The specified module could not be found.
18:27:02.121: (126)
18:27:02.121: Module '../../obs-plugins/64bit/obs-gstreamer.dll' not loaded"

I cant see what I have missed, any ideas please?

Thank you
 

JohnInStockie

New Member
Thanks TUNA

Took my 2 goes to spot the "... added to the PATH env variable ..." lol, but spotted it AND IT WORKS Hurrah!!

THANK YOU VERY MUCH, this will be a game changer (I hope) :)

John
 

slamuraishaq

New Member
hello, is there a plugin available to capture a particular window to then pipe into the rest of gstreamer? i tried using a separate instance of obs that outputs to a udp uri to then bring into a 2nd obs instance via gstreamer source but it resulted in occasional frame drops.
i'm on windows 10.

i see plugins for recording an entire screen and has capability to grab windows by id, but haven't been able to figure out how to grab window ids in windows 10.
 
Top