Deepstream I frame and RTMP stream delay 2s

Pipeline

uridecodebin,streammux,pgie, nvtracker, tiler, nvvidconv0, nvosd, nvvidconv1, filter, nvv4l2h264enc, h264parse, flvmux, rtmpsink

RTSP 25FPS I frame interval:50

When I pull the stream from the RTMP server, it is two seconds behind the RTSP source screen.

When I chang 50 to 2( I frame interval),When I pull stream from RTMP server, there is almost no delay than RTSP source screen.

I think it is the pull stream plugin and push stream plugin and the I frame interval affect the delay of the RTMP stream, but I did not understand the reason and how to deal with the delay?
• Hardware Platform (Jetson / GPU)
• DeepStream Version 5.0DP
• JetPack Version (valid for Jetson only)
• TensorRT Version 7
• NVIDIA GPU Driver Version (valid for GPU only)

Do you mean you push the rtsp stream to rtmp server and then pull with deepstream app?

The difference of delay is not caused NV components(nvstreammux, nvv4l2decoder, nvosd,nvvidconv,…) because they do not rely on I frame intervals of the compressed video.
Maybe you need to check the time the rtmp server push the stream.

RTSP → deepstream infer → rtmp_sink → RTMP server

I had chang pipeline to rtspsrc,rtph264depay,nvv4l2decoder,streammux,pgie, nvtracker, tiler, nvvidconv0, nvosd, nvvidconv1, filter, nvv4l2h264enc, h264parse, flvmux, rtmpsink

It is almost no delay. Maybe uridecodebin is

Any idea why uridecodebin has this delay but rtspsrc doesn’t?