Not getting stream from AI Bridge

We have an issues where when either of the 2 scenarios happen, we no longer are able to get an RTSP stream from AI Bridge unless we restart the AI Bridge.

Using AI Bridge v2.0.1

  1. Scenario 1: If the camera goes offline, and then comes back online
  2. Scenario 2: When we restart our application - i.e. if we try to get the stream the first time, it’s fine, restart our application (or try and get the stream a second time) and it doesn’t work, we restart AI Bridge and then we get the stream back.

I have attached the logs for the following services:

  • streaming
  • connector
  • broker

Can anyone assist on this?

Hi @Abaas Mahroos​ ,

Sorry for the late response.

The problem as I see it is that your application needs to include ‘reconnection’ logic.

The RTSP server will never re-stablished a lost connection with all its clients. Is up to the clients to reconnect once they detect a broken connection.

You can confirm this for instance using VLC.

VLC implements reconnect logic, thus when the AI Bridge is down and the feed is no longer working, VLC will not present any video, however, when the AI Bridge is back online, VLC will be able to automatically reconnect.

All in all, you should implement reconnect logic on your application.

BR

You can combine the reconnect logic with a subscription to a failing deviceStatus for the relevant device(s) and observe the failing status “When true, the VMS is not able to communicate with the device. The reason is often due to a broken connection…”

@Hans Kierulff​ regarding this - I tested this scenario:

VLC with RTSP stream, then I disable the camera - effectively no stream, a few seconds later I re-enable the camera. VLC does not reconnect.

This makes me think it is a server-side issue not a client side issue.

I guess the problem is that clients when connecting to the RTSP stream should use TCP instead of UDP.

Context:

AI Bridge will use TCP or UDP on rtsp connections based on what the client wants.

UDP doesn’t guarantee that the receiver read the correct packages, it basically goes as a ‘fire and forget’

Also, when there are collisions when transferring the data:

* UDP, there’s no retransmission

* TCP, TCP layer will try to re-transmit that package

VLC uses UDP by default for RTSP connections.

If you modify this setting:

Tools → Preferences

Click ‘All’ option:

Demuxers → RTP/RTSP

So in your code as a client, check the rtsp library being used and enforce tcp.

Here’s the video I’ve recorded showing how when enabling and disabling a camera, VLC is capable of resume and go on (I didn’t need to restart any AI Bridge service).

Rtps-Connection

Video url-link: https://download.milestonesys.com/aibridge/Rtps-Connection.gif

I appreciate the clarification, our application is definitely using TCP we made sure of that from the start. Yet we are facing the same issue.

They are wireless cameras, so connection isn’t always stable and when no frames are sent - it disconnects and only reconnects when we restart the entire AI Bridge.

Is it also not intresting that we get odd results when we investigate, as shown below, we connect but no data is given back:

We can’t reproduce that environment with our current cam lab.

What you can do is:

Using Smart Client, record one of the problematic cameras and do an EXPORT selecting "“XProtect format” then we will be able to have exactly the same recording that is apparently causing problems with the rtsp and try to reproduce and debug this specific scenario.

Hi Lisber, is there another private forum I can share the export to? I would not be able to share a video from our site publicly?

We have also tried numerous other techniques for reconnection, brought in another expert in RTSP streams, but the issue remains so this is becoming a big problem in all of our sites.

If you share an email or @Hans Kierulff​ already has our information - we can send the moment that this happens.

Can you please open a support case ticket. Then our support engineers will help us get the footage (they do this quite often).