无法在 OpenCV 中录制高分辨率视频

问题描述

我有一个新的 USB 摄像头。这是相机信息

<div class="tab-interpage> == $0
        <div class="resultat">
             <b>54</b> 
             ligne(s) trouvée(s)
        </div>
...

我正在尝试使用 VIdioC_ENUM_FMT Index : 0 Type : Video Capture Pixel Format: 'MJPG' (compressed) Name : Motion-JPEG Size: discrete 1920x1080 Interval: discrete 0.033s (30.000 fps) Size: discrete 1280x720 Interval: discrete 0.033s (30.000 fps) Size: discrete 800x480 Interval: discrete 0.033s (30.000 fps) Size: discrete 640x480 Interval: discrete 0.033s (30.000 fps) Size: discrete 640x360 Interval: discrete 0.033s (30.000 fps) Size: discrete 320x240 Interval: discrete 0.033s (30.000 fps) Size: discrete 176x144 Interval: discrete 0.033s (30.000 fps) Size: discrete 800x600 Interval: discrete 0.033s (30.000 fps) Size: discrete 1920x1080 Interval: discrete 0.033s (30.000 fps) Index : 1 Type : Video Capture Pixel Format: 'YUYV' Name : YUYV 4:2:2 Size: discrete 640x480 Interval: discrete 0.033s (30.000 fps) Size: discrete 640x360 Interval: discrete 0.033s (30.000 fps) Size: discrete 320x240 Interval: discrete 0.033s (30.000 fps) Size: discrete 176x144 Interval: discrete 0.033s (30.000 fps) Size: discrete 640x480 Interval: discrete 0.033s (30.000 fps) 录制视频,但是 MJPG 在录制时使用 opencvYUYV 和 5 640x480这个设置。我可以手动设置 30 fps,但是当我增加宽度或高度时,我无法录制视频...

fps

我的 cam = cv2.VideoCapture(0,cv2.CAP_V4L2) width = int(cam.get(cv2.CAP_PROP_FRAME_WIDTH)) #max height = int(cam.get(cv2.CAP_PROP_FRAME_HEIGHT)) fps = cv2.CAP_PROP_FPS cam.set(3,width) cam.set(4,height) fourcc = cv2.VideoWriter_fourcc(*'MPEG') cv2.VideoWriter(file_name,fourcc,fps,(width,height)) ('4.5.1') 是用这个标志 (aarch linux) 从源代码编译的

opencv

顺便说一句。

cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D WITH_CUDA=ON \
    -D CUDA_ARCH_PTX="" \
    -D CUDA_ARCH_BIN="5.3,6.2,7.2" \
    -D WITH_CUBLAS=ON \
    -D WITH_LIBV4L=ON \
    -D BUILD_opencv_python3=ON \
    -D BUILD_opencv_python2=OFF \
    -D BUILD_opencv_java=OFF \
    -D WITH_GSTREAMER=ON \
    -D WITH_GTK=ON \
    -D BUILD_TESTS=OFF \
    -D BUILD_PERF_TESTS=OFF \
    -D BUILD_EXAMPLES=OFF \
    -D OPENCV_ENABLE_NONFREE=ON \
    -D OPENCV_EXTRA_MODULES_PATH=/home/`whoami`/opencv_contrib/modules ..

对我不起作用。而且 v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=MJPG 不会记录大于 640x480...

请问问题出在哪里?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)