I’ve recently purchased a new camera that is capable of streaming 60fps on HD resolution. while using the most basic gst-launch-1.0 line : gst-launch-1.0 v4l2src ! xvimagesink
it opens the camera on high res with high FPS with no lag and no freezing.
However, when trying to start the camera on opencv VideoCapture module, anything above 640x480 freezes a lot and gives very low FPS. My best guess is that my pipelines are not ideal and I am not running the camera as intended on HW accelerated pipeline, but rather eating up my CPU which can’t handle the stream, as well as running on an uncompressed format UYVY.
A few pipelines examples that i’ve tried:
cv2.VideoCapture('v4l2src device=/dev/video0 ! video/x-raw,width=1920,height=1080! nvvidconv flip-method=2 ! video/x-raw(memory:NVMM), format=I420! nvvidconv ! video/x-raw, format=BGRx , width=1920, height=1080, framerate=60/1 ! videoconvert ! video/x-raw, format=BGR ! appsink drop=True sync=False')
cv2.VideoCapture('v4l2src device=/dev/video0 ! videoconvert ! video/x-raw, format=BGR ! appsink')
Would appreciate any help and examples of better pipelines, I haven’t found many v4l2src examples if any and non worked well for me.
i should add basic camera information from gst-device-monitor-1.0
:
Device found:
name : See3CAM_CU30
class : Video/Source
caps : video/x-raw, format=(string)UYVY, width=(int)2304, height=(int)1536, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 24/1, 12/1 };
video/x-raw, format=(string)UYVY, width=(int)2048, height=(int)1536, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 42/1, 21/1 };
video/x-raw, format=(string)UYVY, width=(int)2304, height=(int)1296, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 30/1, 15/1 };
video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1280, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 50/1, 25/1 };
video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 60/1, 30/1, 15/1 };
video/x-raw, format=(string)UYVY, width=(int)1280, height=(int)960, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 58/1, 30/1 };
video/x-raw, format=(string)UYVY, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 60/1, 30/1 };
video/x-raw, format=(string)UYVY, width=(int)1152, height=(int)768, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 60/1, 30/1 };
video/x-raw, format=(string)UYVY, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 60/1, 30/1 };
image/jpeg, width=(int)2304, height=(int)1536, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)48/1;
image/jpeg, width=(int)2048, height=(int)1536, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)50/1;
image/jpeg, width=(int)2304, height=(int)1296, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1;
image/jpeg, width=(int)1920, height=(int)1280, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)50/1;
image/jpeg, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1;
image/jpeg, width=(int)1280, height=(int)960, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)58/1;
image/jpeg, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1;
image/jpeg, width=(int)1152, height=(int)768, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1;
image/jpeg, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1;
properties:
udev-probed = true
device.bus_path = platform-3610000.xhci-usb-0:3.4:1.0
sysfs.path = /sys/devices/3610000.xhci/usb2/2-3/2-3.4/2-3.4:1.0/video4linux/video0
device.bus = usb
device.subsystem = video4linux
device.vendor.id = 2560
device.vendor.name = "e-con\\x20systems"
device.product.id = c130
device.product.name = See3CAM_CU30
device.serial = e-con_systems_See3CAM_CU30_152B9904
device.capabilities = :capture:
device.api = v4l2
device.path = /dev/video0
v4l2.device.driver = uvcvideo
v4l2.device.card = See3CAM_CU30
v4l2.device.bus_info = usb-3610000.xhci-3.4
v4l2.device.version = 264701 (0x000409fd)
v4l2.device.capabilities = 2216689665 (0x84200001)
v4l2.device.device_caps = 69206017 (0x04200001)
gst-launch-1.0 v4l2src ! ...