I have bought a usb camera with uvc drivers so it is plug and play on the mallow carrier board which we are using. I am noticing though when i run the camera, i get large scale fluctuations on my loop timings. The camera seems to jog between 25fps to 17fps. The loop is doing a bunch of other things, but when i run the script on a csi camera, i get a consistent 22 fps output. This is all done in python using opencv.
Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!
Did you like my answer?
The inconsistent frame rate you’re experiencing with the USB camera could be due to several factors:
USB Bandwidth and Latency: USB cameras can be affected by bandwidth limitations and latency, especially if other USB devices are connected to the same bus. This can cause fluctuations in frame rate.
CPU Load: Since your loop is doing a bunch of other things, it’s possible that the CPU is being overloaded, which can affect the processing of video frames. The CSI camera might be less affected due to its direct connection to the SoC, which can handle data more efficiently.
Driver and Kernel Version: Ensure that the UVC drivers are up-to-date and compatible with your kernel version. Sometimes, driver issues can cause performance inconsistencies.
Power Management: Check if there are any power management settings that might be affecting the USB ports, causing them to throttle under certain conditions.
OpenCV and Python Overhead: Python and OpenCV can introduce additional overhead compared to lower-level implementations. Consider optimizing your code or using a more efficient language for critical sections.
GStreamer Pipeline: As mentioned in the context, using GStreamer might provide a more stable pipeline for video capture. You could try setting up a GStreamer pipeline to see if it offers more consistent performance.
You might want to monitor the system’s resource usage (CPU, memory, USB bandwidth) while running your application to identify any bottlenecks. Additionally, testing with a different USB port or reducing the load in your loop could help isolate the issue.
Please, also check if these links can help you solve your problem:
USB Bandwidth and latency: No other usb devices are currently on the bus. The camera came with a USB3.1 cable as well.
CPU Load: The unit does not run above 25% CPU usage ever
Driver and Kernel Version:
v4l2-ctl --list-devices --device /dev/video2 -D output:
Driver Info:
Driver name : uvcvideo
Card type : See3CAM_CU55
Bus info : usb-xhci-hcd.1.auto-1.1
Driver version : 5.15.129
Capabilities : 0x84a00001
Video Capture
Metadata Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:
Driver name : uvcvideo
Model : See3CAM_CU55
Serial : 28295101
Bus info : usb-xhci-hcd.1.auto-1.1
Media version : 5.15.129
Hardware revision: 0x00000000 (0)
Driver version : 5.15.129
Interface Info:
ID : 0x03000002
Type : V4L Video
Entity Info:
ID : 0x00000001 (1)
Name : See3CAM_CU55
Function : V4L2 I/O
Flags : default
Pad 0x01000007 : 0: Sink
Link 0x02000010: from remote pad 0x100000a of entity ‘Extension 3’ (Video Pixel Formatter): Data, Enabled, Immutable
Power Management: I have disabled USB Power Management Globally
UYVY 4:2:2 and MJPEG formats are supported by your cameras, with resolutions ranging from 640x480 to 2592x1944. Are the format and resolution settings configured in the Python application?
I do more tests with a USB camera.
Build a container with VPU accelerated according to this page.
set ARG BASE_VERSION to 3.2.1 so that it builds successfully.
add command: tail -f /dev/null to the built container in the docker-compose file. It will stop the default vputests.sh from launching and allow you to show video from the USB camera with gst pipeline.