Latency and video artifacts in multiple RTSP I/O

  1. could you share the whole Gstreamer pipeline? what elements are used? You can use forum private email for the private information. please click forum avatar-> personal messages->new message.

I will get back to you on this.

  1. using two Dahua camera has issue while using two HIKVISION camera has no issue. the only one difference is RTSP source. so please check the Dahua camera first. In the log with GST_DEBUG=rtspsrc:7, are there “missing packets” or “dropping old packet” printing? which means packets loss.

Just to clarify - I see the video artifact issue happen irrespective of the camera utilized. This happens when I increase the number of streams being processed. The latency/buffering issue happens based on the camera type.

Regarding the video artifact issue, I was not able to see the packet loss logs with GST_DEBUG=rtspsrc:7. However on using GST_DEBUG=3,rtpjitterbuffer:6,v4l2videodec:6 as mentioned in this topic, I get the following logs when artifacts are visible in the output stream.

0:02:33.946446108   449 0xfffe2401c580 DEBUG        rtpjitterbuffer gstrtpjitterbuffer.c:2518:calculate_packet_spacing:<rtpjitterbuffer2> new packet spacing 0:00:00.033008575 old packet spacing 0:00:00.044952160 combined to 0:00:00.041966263
0:02:33.946457564   449 0xfffe2401c580 DEBUG        rtpjitterbuffer gstrtpjitterbuffer.c:3211:gst_rtp_jitter_buffer_chain:<rtpjitterbuffer2> Queue full, dropping old packet 0xfffe640f22c0
0:02:33.946479901   449 0xfffe2401c580 DEBUG        rtpjitterbuffer gstrtpjitterbuffer.c:3268:gst_rtp_jitter_buffer_chain:<rtpjitterbuffer2> Pushed packet #24722, now 221 packets, head: 0, percent -1
0:02:33.946531358   449 0xfffe74002aa0 DEBUG        rtpjitterbuffer gstrtpjitterbuffer.c:2983:gst_rtp_jitter_buffer_chain:<rtpjitterbuffer3> Received packet #24722 at time 0:02:33.542100394, discont 0, rtx 0
0:02:33.946315417   449 0xfffe8c0041e0 LOG          rtpjitterbuffer gstrtpjitterbuffer.c:2687:calculate_jitter:<rtpjitterbuffer0> dtsdiff 0:00:00.020016972 rtptime 0:00:00.033000000, clock-rate 90000, diff 0:00:00.012983028, jitter: 0:00:00.008487163
0:02:33.946592351   449 0xfffe74002aa0 LOG          rtpjitterbuffer gstrtpjitterbuffer.c:2687:calculate_jitter:<rtpjitterbuffer3> dtsdiff 0:00:00.020229136 rtptime 0:00:00.033000000, clock-rate 90000, diff 0:00:00.012770864, jitter: 0:00:00.008343601
0:02:33.946600479   449 0xfffe8c0041e0 DEBUG        rtpjitterbuffer gstrtpjitterbuffer.c:3083:gst_rtp_jitter_buffer_chain:<rtpjitterbuffer0> expected #24788, got #24788, gap of 0
0:02:33.946629728   449 0xfffe8c0041e0 DEBUG        rtpjitterbuffer gstrtpjitterbuffer.c:3113:gst_rtp_jitter_buffer_chain:<rtpjitterbuffer0> Clearing gap packets
0:02:33.946649121   449 0xfffe8c0041e0 DEBUG        rtpjitterbuffer rtpjitterbuffer.c:800:rtp_jitter_buffer_calculate_pts: extrtp 1633457616, gstrtp 5:02:29.529066666, base 4:59:56.056066666, send_diff 0:02:33.473000000
0:02:33.946660033   449 0xfffe8c0041e0 DEBUG        rtpjitterbuffer rtpjitterbuffer.c:579:calculate_skew: time 0:02:33.541863333, base 0:00:00.072121920, recv_diff 0:02:33.469741413, slope 8
0:02:33.946665793   449 0xfffe8c0041e0 DEBUG        rtpjitterbuffer rtpjitterbuffer.c:659:calculate_skew: delta -3258587, new min: -3316500
0:02:33.946671681   449 0xfffe8c0041e0 DEBUG        rtpjitterbuffer rtpjitterbuffer.c:681:calculate_skew: skew -4008129, out 0:02:33.541113791
0:02:33.946681025   449 0xfffe8c0041e0 DEBUG        rtpjitterbuffer gstrtpjitterbuffer.c:2518:calculate_packet_spacing:<rtpjitterbuffer0> new packet spacing 0:00:00.033005578 old packet spacing 0:00:00.044953891 combined to 0:00:00.041966812
0:02:33.946689762   449 0xfffe8c0041e0 DEBUG        rtpjitterbuffer gstrtpjitterbuffer.c:3211:gst_rtp_jitter_buffer_chain:<rtpjitterbuffer0> Queue full, dropping old packet 0xfffe64105980
0:02:33.946696130   449     0x12da0580 DEBUG        rtpjitterbuffer gstrtpjitterbuffer.c:2983:gst_rtp_jitter_buffer_chain:<rtpjitterbuffer4> Received packet #24722 at time 0:02:33.542365169, discont 0, rtx 0
0:02:33.946703330   449 0xfffe8c0041e0 DEBUG        rtpjitterbuffer gstrtpjitterbuffer.c:3268:gst_rtp_jitter_buffer_chain:<rtpjitterbuffer0> Pushed packet #24788, now 221 packets, head: 0, percent -1
0:02:33.946725123   449     0x12da0580 LOG          rtpjitterbuffer gstrtpjitterbuffer.c:2687:calculate_jitter:<rtpjitterbuffer4> dtsdiff 0:00:00.020272722 rtptime 0:00:00.033000000, clock-rate 90000, diff 0:00:00.012727278, jitter: 0:00:00.008375080
0:02:33.946736963   449     0x12da0580 DEBUG        rtpjitterbuffer gstrtpjitterbuffer.c:3083:gst_rtp_jitter_buffer_chain:<rtpjitterbuffer4> expected #24722, got #24722, gap of 0
0:02:33.946741795   449     0x12da0580 DEBUG        rtpjitterbuffer gstrtpjitterbuffer.c:3113:gst_rtp_jitter_buffer_chain:<rtpjitterbuffer4> Clearing gap packets
0:02:33.946751587   449     0x12da0580 DEBUG        rtpjitterbuffer rtpjitterbuffer.c:800:rtp_jitter_buffer_calculate_pts: extrtp 1633454646, gstrtp 5:02:29.496066666, base 5:00:41.648066666, send_diff 0:01:47.848000000
0:02:33.946761187   449     0x12da0580 DEBUG        rtpjitterbuffer rtpjitterbuffer.c:579:calculate_skew: time 0:02:33.542365169, base 0:00:45.726063478, recv_diff 0:01:47.816301691, slope 8
0:02:33.946767140   449     0x12da0580 DEBUG        rtpjitterbuffer rtpjitterbuffer.c:659:calculate_skew: delta -31698309, new min: -32239689
0:02:33.946772420   449     0x12da0580 DEBUG        rtpjitterbuffer rtpjitterbuffer.c:681:calculate_skew: skew -32751313, out 0:02:33.541312165

Queue full, dropping old packet seems to be present in the logs which would indicate packet loss at the source. What are potential causes for this issue (drop-on-latency=True in rtspsrc would be one) and why does it happen on increasing the number of streams? As suggested in the topic, I have already tried using drop-on-latency=False in the rtspsrc which leads me to the same issue as the author of that topic faced i.e the output stream starts lagging behind the input stream significantly over a period of time.

Is there any other solution to the video artifact issue without sacrificing the FPS by setting drop-frame-interval in the decoder? EDIT - I see the video artifacts are back when I increase the number of streams from 5 to 10 even with the decoder ‘drop-frame-interval’ property set which means this solution will not scale.

  1. if only using one Dahua camera, will the app run well?

No, I see Queue full, dropping old packet in the logs when using a single Dahua RTSP source within a few mins of starting the application. I don’t see this log when using a single HIKVISION camera source. What might be the reason for it to differ across the cameras?

If I increase the number of RTSP streams with just HIKVISION input the packet drop logs appear and video artifacts are generated.