Latency of 150ms when creating opencv videocapture + gstreamer

Hey,

First post here, please forgive for any error or any missing info in the question.

Device: Jetson Nano, 4GB
Videofile : h264 encoded, 30 fps, 1sec duration
im using this gst pipeline: filesrc location={file_nm} ! qtdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw, format=BGRx ! videoconvert ! video/x-raw,format=BGR ! appsink

then passing it to the cv2.VideoCapture method.
I’ve put time around this method and noticed a 180ms lag here. What could be the reason for this?

Also please help me fix this or explore alternatives
The reason for using Gstreamer is to reduce CPU load.

Hi,
Please set max performance and disable dpb to decoder and try again. May refer to this command:
Improve gstreamer pipeline - #3 by DaneLLL

Hi,

But it didnt help. Still seeing the lag.

filesrc location={file_nm} ! qtdemux ! h264parse ! nvv4l2decoder enable-max-performance=true disable-dpb=1 ! nvvidconv ! video/x-raw, format=BGRx ! videoconvert ! video/x-raw,format=BGR ! appsink sync=false

I get this warning log, maybe some clue is in here?

Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
[ WARN:0] global /home/dream-nano6/Desktop/harshil_ccgrid/opencv/modules/videoio/src/cap_gstreamer.cpp (1063) open OpenCV | GStreamer warning: unable to query duration of stream
[ WARN:0] global /home/dream-nano6/Desktop/harshil_ccgrid/opencv/modules/videoio/src/cap_gstreamer.cpp (1100) open OpenCV | GStreamer warning: Cannot query video position: status=1, value=0, duration=-1

More to add, I have maxn and clocks enabled.

Hi,
The pipeline looks optimal. For running with OpenCV there is memory copy and format conversion on CPU cores This is very likely to be the bottleneck. Please run sudo tegrastats to get system status.

Not sure if it helps but please set sync=0 for a try.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.