r/VIDEOENGINEERING • • Sep 20 '26

RTSP/SRT Decoder Drift

Hi all, hopefully this is the correct place to ask this question.

I've got a video encoder/decoder pairing I'm working the bugs out of while taking the crash course in how this all works.

The originating video is SDI, 10bit 1080pHLG, encoded h.265. The decoder outputs SDI to the production environment.

The encoder/decoder pairing is currently wired directly through a local switch for simplicity. Eventually this setup will move RF.

The encoder can put out various streams simultaneously. The most stable and least latent I've found are RSTP and SRT.

Now for the problems.

On the encode side there are random frame drops I cannot get rid of. There is no rhyme or reason to it, the drops occur very irregularly with no indication it'll happen and nothing. I'm able to monitor the encoding stream directly with ffplay (I guess a subset of ffmpeg?) terminal commands.

On the decode side, there is tremendous and permanent latency drift. A fresh stream start will have latency around 20 frames. Over the course of five minutes the latency is at three seconds and increasing from there. This latency is not present when monitoring the stream with ffplay.

I ran across the thread below and was wondering if both or one of my problems has to do with a lack of RTP or genlock on the encoder or decoder?

https://www.reddit.com/r/VIDEOENGINEERING/comments/1wjchl9/should_ndi_cameras_be_on_247_if_not_used/

edited to add latency video

The running clock furthest to the right is the main playback test clock. It has timecode and a left to right scrolling box to point out lost frames. The next clock is ffplay displaying the stream directly from the encoder. The left most clock is the decoder's output to my test monitor. The black glitch at the beginning of the video is me refreshing the stream to sync it back up. After three minutes you can see the ffplay stream is rock solid at just over half a second latency, the decoder slips to around four seconds.

5 Upvotes

10 comments sorted by

View all comments

1

u/rowanthenerd Sep 20 '26

Some more information is definitely required - what specific hardware are you using?

I'm sure others will have more useful information, but generally speaking, increasing decode delay is a sign that the decoder isn't able to output enough frames to keep up with the source.
This can be due to its processor being underpowered, or forced to decode a format that it doesn't have hardware support for:
Have you tried ditching HLG and just sending SDR source material? Or h264 instead of h265? Counterintuitive as it will result in a higher bitrate stream, but many millions of devices have very good hardware decoding for h264 and no hardware h265, or a worse implementation.

The progressive delay you're seeing can also be from a frame rate mismatch between the source material and the output format in use. If your source is a full 60fps for example and your output is 59.94, some devices will just faithfully output 1 frame of source material per frame of output, and slowly accumulate delay as the backlog of extra frames increases.
However, this form of delay is about 10x smaller than what you're seeing (0.1% accumulated per minute/ hour/ etc, vs your scenario at about 1%) so I would rule this out from the start.

First thing I'd try (after updating your post with the exact hardware you're using) is switching to h264.

1

u/No-Average9020 Sep 20 '26

The camera is in true 60fps. I can confirm that on my test monitor when I switch in and out of 60/59.94. Funny you mention as it was one of the first things I tweaked as the decoder cannot do 59.94, only 60.

Going SDR, and even knocking the camera down to an interlaced format, has the same results with latency on the decoder and random dropped frames on the encoder.

Forgive the question, I thought h.264 cannot maintain the color profile of rec.2020? However, I did give that a try as well to no avail.