Hi there,
For our use case in our RPA, we require 3x IMX477 cameras to be run through a single USB2.0 hub before interfacing with our companion computer (Orin Nano 8GB).
We are using the official B0278 UVC USB adapter board between the camera and the USB hub.
Currently, we are unable to initialise 3x GStreamer pipelines at full rez (4032x3040) at the lowest “allowed” framerate of 10FPS, with a lack of USB2.0 bandwidth identified. 2x Gstreamer pipelines across 1 USB 2 connection and the other pipeline on a separate connection operates without issue at 10FPS, but this is not suitable as we require that USB2.0 connection for another device.
As we do not require high framerates, we could easily get away with a 1FPS pipeline for all cameras to save bandwidth and allow all cameras to run through a single hub. However, when setting the framerate below 10FPS we encounter an error as it is outside the driver’s discrete resolution/framerate settings.
Our script is as follows:
import time
import cv2
import argparse
def get_args():
parser = argparse.ArgumentParser(description="Get video feed from camera")
parser.add_argument("--width", "-W", type=int, default=4056, help="Width of the frame")
parser.add_argument("--height", "-H", type=int, default=3040, help="Height of the frame")
return parser.parse_args()
def get_gstreamer_camera(camera):
return (
f"v4l2src device=/dev/video{camera} !"
"image/jpeg,format=MJPG,width=4032,height=3040,framerate=10/1 !"
"nvv4l2decoder mjpeg=1 ! nvvidconv ! video/x-raw,format=BGRx ! appsink drop=1"
)
def get_camera(camera, args):
cap = cv2.VideoCapture(get_gstreamer_camera(camera))
return cap
def main():
args = get_args()
cameras = [get_camera(c, args) for c in [0, 2, 4]]
while True:
for index, cap in enumerate(cameras):
start_time = time.time()
print(f"Capturing frame {index} at {start_time}")
ret, frame = cap.read()
if not ret:
print(f"cap fail for {index}")
break
cv2.imwrite(f"test_{index}.jpg", frame)
end_time = time.time()
print(f"Time taken to capture frame {index}: {end_time - start_time}")
time.sleep(4)
if __name__ == "__main__":
main()
In short, what method should we use/how do we go about enabling a custom framerate below 10FPS? We are happy to explore any avenue to enable this feature.
Many thanks.