Hi everyone,
I’m currently working on a project where I need to synchronize four RTSP camera streams using GStreamer. Initially, the streams are in sync, but over time, they tend to drift out of synchronization. This is quite problematic for the application I’m working on.
Here’s a brief overview of my setup:
- Four RTSP camera sources
- Live streams (not pre-recorded)
- GStreamer pipeline handling the streams (it doesn’t matter if it’s an empty pipeline with cameras going straight to
fakesink
or a DeepStream pipeline used in the production environment)
I’ve tried several methods to address the desynchronization issue, but none have been successful so far:
- Flushing the pipeline
- Sending latency messages
- Stopping and playing the streams again
- Resetting
GST_CLOCK
Despite these efforts, the streams still go out of sync after some time. I suspect that the cameras themselves might be contributing to the desynchronization. However, I’m looking for a solution that can force the streams back into sync when desynchronization occurs (this should be possible due to them being live sources, I believe).
Has anyone encountered a similar issue or have any suggestions on how to maintain synchronization for live RTSP streams over extended periods? Additionally, if desync does happen, what steps can be taken to force the streams back into sync?
Also, I provided some graphs that explain my issue. It is a PTS probe graph and, as you can see, the cameras seem to lag for a bit and then never sync again. It can be seen to drift (PTS value) by around 1 second. After a while, the second and third cameras drift and seem to be in sync with the first desynced camera.
Any advice or insights on this matter would be greatly appreciated. Thanks in advance for you help.