Using DragonBoard 410c to preview usb camera and record at the same time


I’m trying to use python and OpenCv to do it on Debian OS. It will succesfully capture the view at the default resolution 640x480. But if I set the resolution to 720p I can only get white frame.

Here is my code

import cv2

cap = cv2.VideoCapture(0)

ret, frame =
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2BGRA)
cv2.imshow(‘frame’, gray)
if cv2.waitKey(1) & 0xFF == ord(‘q’):


Does the board have not enough performance to meet my needs? If so ,can someone recommend me a suitable board?

Maybe try with a known working tool before, like gstreamer, e.g:

 gst-launch-1.0 v4l2src device="/dev/v4l/by-id/usb-Generic_USB2.0_PC_CAMERA-video-index0" \
! video/x-raw,width=1280,height=720 \
! autovideosink

Don’t know exactly your needs, but db410c can certainly display 720p video.

@Loic: Are you sure about that? If he’s running a 720p uncompressed video stream, that will require 531 Mbps at 24 fps.

1280x720x3x8x24 = 530,841,600
Note: 3 colors x 8 bits per pixel.

That is well above the limit of USB 2.0.

@sccdhyt : Try reducing your framerate to around 5 fps, or try using compressed video (if your camera supports any).

Yeah, I know db410c can play 720 video. I made it by using uvcview to display usb camera by mjpg at 1080p 30fps.
My need is that display the camera view at least 720p 30fps, better 60fps, and record it.
I had checked that my camera do support 720p 60fps mjpg by v4l2-ctl.
I need to start recording by udp trigger, so I had to write a python scrip myself. But I really don’t know why it even can’t display 720p 30fps video when I use opencv.

Thank you, I will try 5fps if it will work.
My camera do support mjpg 720 60fps, and I also had tried to set it to mjpg in my code but didn’t work.
Is there a full sample of python-opencv code to set resolution, frame rate, and compression method of a v4l2 camera?
I really don’t know if there is something wrong in my code.

I have no experience at all with opencv, so I can’t advise you on that.
As @Loic suggested, start off getting it to work with a known working tool. My go-to tool for video capture is ffmpeg, which would expect parameters something like this;

-r 5 -input_format mjpeg -video_size 1280x720

Note that I’ve included both the framerate and compressed video parameters in there.

Something like this might simulate what you are trying to achieve;
ffmpeg -f v4l2 -r 15 -input_format mjpeg -video_size 1280x720 -i /dev/video0 -map 0 -c:v copy -f tee "test.mkv|[f=nut]pipe:" | ffplay pipe: