Question / Help RTSP stream from IP camera delay in input in preview

JTDani

New Member
I am also having a similar issue using my rtsp feed with IP Cameras. My 2 cameras have a 30 second or so daly which I would like fixed but is useable at this point. One of my cameras doesn't appear to work at all at first but If I leave it on the camera feed shows a couple hours later and is a couple hours behind. The odd part is that I do not have the camera recording anywhere so how and where is 2 hours of data being stored?
They also all work perfectly doing a test with the VLC media player.
The cameras are cheap($150) chinese security cameras but my Church has a low if not non-existent budget for this.
Any Ideas on where to look for this issue would be helpful.
 

Softrax

New Member
I have the same issue, using Dahua cameras at our church. We have 4 cameras runnning. The delay on the RTSP stream is about 2 secs. This is particularly annoying when operating a PTZ camera with a joystick.
However, if I use this program: https://www.deskshare.com/ip-camera-viewer.aspx I get no latency. I can then detach each camera into a separate window and use the (maximised) window as a source in OBS. It takes a bit of setting up each time, but it does work. You can use the Pro (paid) version if you want to get rid of the date stamp, but I just zoomed in a little bit in OBS to hide that.
My question would be, if a third party program can stream RTSP without latency, then why cant OBS? Is this something that can be done within OBS at all?
 

Softrax

New Member
Regarding the lost time, I set the bitrate setting in the camera is as high as possible. So my PTZ, which was the main culprit, was commonly losing up to 10 seconds in an hour. So now I run it at 720p with a bitrate of 8192 and it seems to be OK. Maximise the bitrate across the LAN and then run a lower bitrate from OBS to the streaming provider, such as SermonAudio or Youtube. I use 720p and 1200 for that but I'm still experimenting with it.
 

STEPHANVS

Member
I managed to reduce the stream delay to 300ms, my problem is, that the delay is not consistent, it varies between OBS startups (lowest was 300ms, it can go up to 2-3 seconds), so we have to restart OBS (or reattach the stream) until it reaches 300ms. As the audio from the mixing desk is realtime, delay is introduced on the source, and it look dumm, when video and audio is not in sync...

I tried native rtsp source, VLC source (reducing network cache to 100ms both in OBS and in standalone VLC, and OBS clearly adds extra buffer to the stream), nothing comes close to the native video in Internet Explorer...
 

Jeff W

New Member
Same here:
  • 2-4 second lag in RTSP streamed camera, only in OBS. It's roughly 500-750 ms in vMix and VLC. (Using the VLC Video Source is better, but too unstable to use. Once my camera shut off, and came back up in a different resolution.)
  • The lag changes every time OBS or the input restarts. This is incredibly frustrating when trying to sync the camera to audio, or other cameras.
This is a real problem -- one of the only things keeping me from using OBS. It's odd that RTSP shares the "Media Source" input type. The usage scenarios of a camera are quite different than a video file.
 

nadasizoltan

New Member
Hello,

I think we have the same problem like you.
We want to build a sreaming system in our church with 3 cameras. We have ptz ip cameras with rtsp stream, an analog audio mixer and we wanted to use the OBS program for streaming, but we noticed that the videos from the cameras are in delay, compared to each other, and also compared to the audio from the analog audio mixer.
In the OBS we can adjust the audio and also the video delay parameters, but we noticed that each time we restart the OBS, the 3 video feeds and the audio feed are delayed in a random way, so the previously adjusted delay compensation parameters are not covering the actual delay situation.
The builders of the system said that maybe using vMix instead of OBS will solve the problem.
Have you had any experiences like this and did you managed to solve it somehow with OBS or other program?

Thank you in advance!
Zoltán
 

STEPHANVS

Member
Hello,

I think we have the same problem like you.
We want to build a sreaming system in our church with 3 cameras. We have ptz ip cameras with rtsp stream, an analog audio mixer and we wanted to use the OBS program for streaming, but we noticed that the videos from the cameras are in delay, compared to each other, and also compared to the audio from the analog audio mixer.
In the OBS we can adjust the audio and also the video delay parameters, but we noticed that each time we restart the OBS, the 3 video feeds and the audio feed are delayed in a random way, so the previously adjusted delay compensation parameters are not covering the actual delay situation.
The builders of the system said that maybe using vMix instead of OBS will solve the problem.
Have you had any experiences like this and did you managed to solve it somehow with OBS or other program?

Thank you in advance!
Zoltán
Hi Zoltán,

We had the random delay issue in the past, but now all 3 cameras have the same ~1100ms delay, so delaying the audio feed with this amount gets everything in sync. There was an OBS version/RTMP source setting where the delay was ~300ms (!). I am not sure what solved the random delay issue or why did the delay jump from 1200ms to 300ms then back to 1100ms, maybe it differs from version to version...

vMix you say?
 

nadasizoltan

New Member
Hi Zoltán,

We had the random delay issue in the past, but now all 3 cameras have the same ~1100ms delay, so delaying the audio feed with this amount gets everything in sync. There was an OBS version/RTMP source setting where the delay was ~300ms (!). I am not sure what solved the random delay issue or why did the delay jump from 1200ms to 300ms then back to 1100ms, maybe it differs from version to version...

vMix you say?
Yes, the builders of the system said that maybe using vMix would solve the problem, so this week we'll try that.
 

Jeff W

New Member
For me, the delay was smaller in vMix, but still a little random. I gave up on RTMP and switched to HDMI / SDI capture cards.
 

Caleb L

New Member
I have found that my delay is about 1200 ms as well using OBS 25.0.8 and a PTZOptics camera. As mentioned by Softrax, if I use the Deskshare IP Camera Viewer, there is no delay. I'm thinking my best solution is to delay the audio to sync it up with the video. I might also mention that I had similar results to other in that using vMix or VLC, there was still a delay, but not as much as OBS. Please let me know if anyone figures out how to get this fixed. It doesn't seem to be a hardware issue since the other software has no delay.
 

ClarksonCote

New Member
So OBS has the ability to set an audio delay in it, or are you delaying the audio elsewhere?

Also, are you able to get the stream to your computer at very high resolution before downsampling in OBS?

I'm tempted to use a PTZ IP camera with RTSP, but I don't want to deal with random delays. Ideally, I also want to import the feed at the full 4K resolution, and then configure a few different scenes ("camera views") with particular zooms, since I'm only streaming at 720p.
 

ClarksonCote

New Member
So OBS has the ability to set an audio delay in it, or are you delaying the audio elsewhere?

Also, are you able to get the stream to your computer at very high resolution before downsampling in OBS?

I'm tempted to use a PTZ IP camera with RTSP, but I don't want to deal with random delays. Ideally, I also want to import the feed at the full 4K resolution, and then configure a few different scenes ("camera views") with particular zooms, since I'm only streaming at 720p.
So we are trying this new setup this weekend. Initial testing suggests we are at about 1300ms delay, repeatable from OBS startups.

The other problem is the audio sync delay doesn’t affect the audio monitoring. We want to send the audio/video to an HDMI output and unless we can get the monitor audio to have the same sync delay, the audio on the HDMI output remains out of sync.
 

Moriah

New Member
So OBS has the ability to set an audio delay in it, or are you delaying the audio elsewhere?

Also, are you able to get the stream to your computer at very high resolution before downsampling in OBS?

I'm tempted to use a PTZ IP camera with RTSP, but I don't want to deal with random delays. Ideally, I also want to import the feed at the full 4K resolution, and then configure a few different scenes ("camera views") with particular zooms, since I'm only streaming at 720p.
The audio delay in OBS is very simple. Go to the settings (little gear button) above the list of audio feeds and set the same time delay for each. We are also at about 1300 milliseconds delay. The resolution of the RTSP feed is very good, and with the camera presets it is easy to zoom in on different areas.
However, I have found that the time of the delay varies, and another technician told me that it can continue to vary with network conditions. Before we used the camera monitoring software (VMS - designed for our particular camera by Sunba) and just shared the window in OBS, and that was consistent with a delay of only about 65 milliseconds. I think we will go back to that, although I don't think the video quality is quite as good.

Other than using a 3rd party software, I don't think the IP camera can give a completely consistent latency. I'm going to try upping the camera bit rate to see what that does.
 

BloodMan

New Member
I have, sadly, same problems like you, guys ;( BCS/Dahua cameras have random delays ;/
...and still looking / testing ;s
 

STEPHANVS

Member
bloodman did you consider using gstreamer as input driver for the ip camera’s?
Found a reference to GStreamer on a VLC bugreport, tried it today. RTSP camera latency went from 1140ms (with built-in Media source) through 400ms (with VLC Video Source) to 60ms!!!!!!!!!! with GStreamer Source!!!! Just came here to spread the good news!

Project:

My steps:
Copy obs-gstreamer.dll from https://github.com/fzwoch/obs-gstreamer/releases/download/v0.1.0/obs-gstreamer.zip (\windows) to PathToOpenBroadcasterSoftware\obs-plugins\64bit\

Get https://gstreamer.freedesktop.org/d...0/mingw/gstreamer-1.0-mingw-x86_64-1.18.0.msi and install. Put PathTo\gstreamer\1.0\mingw_x86_64\bin\ into PATH (or copy libglib-2.0-0.dll, libgobject-2.0-0.dll, libgstapp-1.0-0.dll, libgstaudio-1.0-0.dll, libgstreamer-1.0-0.dll, libgstvideo-1.0-0.dll to PathToOpenBroadcasterSoftware\bin\64bit\, based on https://github.com/fzwoch/obs-gstreamer/issues/13#issuecomment-711106142 but this I have not tried yet...)

Start OBS and add GStreamer Source. We use HikVision IP cameras, my Pipeline looks like this:
Code:
uridecodebin uri=rtsp://username:password@ipaddress/Streaming/Channels/1 name=bin ! queue ! video.
Important to uncheck Sync appsinks to clock, and to my surprise the feed in OBS is lower latency than the feed in Internet Explorer.

Live test on Sunday.
 

Samalama

New Member
So we are trying this new setup this weekend. Initial testing suggests we are at about 1300ms delay, repeatable from OBS startups.

The other problem is the audio sync delay doesn’t affect the audio monitoring. We want to send the audio/video to an HDMI output and unless we can get the monitor audio to have the same sync delay, the audio on the HDMI output remains out of sync.
If you want to delay audio stream and be able to hear it through monitoring it is best to use VST plugin for sound delay, than it works. I recomend ReaDelay
It is free and works fine. Just turn down the dry fader and the feedback fader and set your delay time.
 

Samalama

New Member
Found a reference to GStreamer on a VLC bugreport, tried it today. RTSP camera latency went from 1140ms (with built-in Media source) through 400ms (with VLC Video Source) to 60ms!!!!!!!!!! with GStreamer Source!!!! Just came here to spread the good news!

Project:

My steps:
Copy obs-gstreamer.dll from https://github.com/fzwoch/obs-gstreamer/releases/download/v0.1.0/obs-gstreamer.zip (\windows) to PathToOpenBroadcasterSoftware\obs-plugins\64bit\

Get https://gstreamer.freedesktop.org/d...0/mingw/gstreamer-1.0-mingw-x86_64-1.18.0.msi and install. Put PathTo\gstreamer\1.0\mingw_x86_64\bin\ into PATH (or copy libglib-2.0-0.dll, libgobject-2.0-0.dll, libgstapp-1.0-0.dll, libgstaudio-1.0-0.dll, libgstreamer-1.0-0.dll, libgstvideo-1.0-0.dll to PathToOpenBroadcasterSoftware\bin\64bit\, based on https://github.com/fzwoch/obs-gstreamer/issues/13#issuecomment-711106142 but this I have not tried yet...)

Start OBS and add GStreamer Source. We use HikVision IP cameras, my Pipeline looks like this:
Code:
uridecodebin uri=rtsp://username:password@ipaddress/Streaming/Channels/1 name=bin ! queue ! video.
Important to uncheck Sync appsinks to clock, and to my surprise the feed in OBS is lower latency than the feed in Internet Explorer.

Live test on Sunday.
Great news! And is the delay constant through GStreamer?
 

STEPHANVS

Member
Great news! And is the delay constant through GStreamer?
Delay is consistent. Having no buffer is visible sometimes, some frames do lag a little (frame jumping?), see example here, between 59:09 - 59:24.
Next test will be with 1-3 frame buffer (+40-120ms delay).
 
Top