How to remove buffering from VideoSource


I am using this “jetson.utils.videoSource”
image = input.Capture("/dev/video0")

Can you please help me, is there any solution to remove buffering/caching frames from USB Camera using VideoSource.

Thank you.

hello bryllatKS,

there’s default queue numbers in the v4l2 code, could you please also share the actual use-case for reference?

Hi, JerryChang

Usecase is: I have a camera in port “/dev/video0” that ‘videoSource’ reads.
Step 1: I use detectnet ‘ssd-mobilenet-v2’ from inference to detect people
Step 2: if someone.isDetected() do mqtt.sendPub(“Message”,“Topic”)
This 2 steps takes longer then 3 second to send messege after a person is detected
I have been playing around with it and i found it out that image = input.Capture("/dev/video0") is sending buffered imges to detection and not realtime image.

Is there any attribute of videoSource so i can clear his cache memory or reduce buffer size or something similary?

Thank you.

Please refer to the source code:
jetson-utils/gstCamera.cpp at ebf55857d60ba0be5c655cacf8eb8e9348ace714 · dusty-nv/jetson-utils · GitHub
The implementation is based on gstreamer v4l2src plugin. You can check if there is extra controls you can set to the camera source and set it through

  extra-controls      : Extra v4l2 controls (CIDs) for the device
                        flags: readable, writable
                        Boxed pointer of type "GstStructure"

hello bryllatKS,

you should look into kernel sources about queue setups, (i.e. vi_setup_queue())
it usually allocated 3 buffers, which is a good minimum number; because DMA need a minimum of 2 buffers in the queue, and you need to have another 1 available for user-space processing.