I have developed a custom GStreamer component infer
that runs a neural network model. This component takes approximately 100ms to process each frame, leading to an expected frame rate of around 10 fps. However, I am facing an issue where the pipeline reports lost frames, resulting in an effective frame rate of about 1 fps. The error message is:
0:00:47.405558285 4623 0xaaab095005e0 WARN v4l2src gstv4l2src.c:1352:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 21 - ts: 0:00:46.169338790
Here is the pipeline configuration I am using:
webrtcbin bundle-policy=max-bundle latency=0 name=sendrecv
v4l2src ! capsfilter caps="video/x-raw, width=1920, height=1080, framerate=25/1" ! videoconvert ! infer use_npu=True type=yolov5 model=yolov5n.tflite labels=yolov5n.txt ! videoconvert ! queue max-size-buffers=1 ! x264enc bitrate=5000 speed-preset=superfast tune=zerolatency ! video/x-h264, stream-format=byte-stream ! rtph264pay config-interval=1 ! application/x-rtp,media=video,encoding-name=H264,payload=127 ! sendrecv.
I suspect that the frames are being processed too slowly, causing a backlog that results in frame drops. I want to drop frames before they are processed by the `infer` element if it is still busy with the previous frame processing. How can I achieve this? Or is there any other solution?
p.s. I do 'gst_bin_recalculate_latency' when receive the message `GST_MESSAGE_LATENCY` and set pipeline latency to 250. But it doesn't help.
New contributor
Александр is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.