• linux USB摄像头 V4L2工具调试摄像头


    1.v4l2-ctl 常用操作

    安装V4l2工具包

    sudo apt install v4l-utils
    
    • 1

    通过v4l2查看摄像头设备

    sudo v4l2-ctl --list-devices
    
    • 1

    USB2.0 PC CAMERA (usb-0000:00:14.0-3): /dev/video0

    USB2.0 PC CAMERA (usb-0000:00:14.0-4): /dev/video1

    查看摄像头所有参数

     sudo v4l2-ctl -d  /dev/video0 --all
    
    • 1
    Driver Info (not using libv4l2): Driver name : uvcvideo Card type
    USB2.0 PC CAMERA Bus info : usb-0000:00:14.0-3 Driver
    version: 4.4.98 Capabilities : 0x84200001 Video Capture
    Streaming Extended Pix Format Device Capabilities Device Caps
    0x04200001 Video Capture Streaming Extended Pix Format
    Priority: 2 Video input : 0 (Camera 1: ok) Format Video Capture:
    Width/Height : 800/600 Pixel Format : ‘MJPG’ Field
    None Bytes per Line : 0 Size Image : 960000 Colorspace
    Default Transfer Function : Default YCbCr Encoding : Default
    Quantization : Default Flags : Crop Capability
    Video Capture: Bounds : Left 0, Top 0, Width 800, Height 600
    Default : Left 0, Top 0, Width 800, Height 600 Pixel Aspect: 1/1
    Selection: crop_default, Left 0, Top 0, Width 800, Height 600
    Selection: crop_bounds, Left 0, Top 0, Width 800, Height 600 Streaming
    Parameters Video Capture: Capabilities : timeperframe Frames per
    second: 30.000 (30/1) Read buffers : 0
    brightness (int) : min=0 max=255 step=1 default=128 value=128
    contrast (int) : min=0 max=255 step=1 default=128 value=128
    saturation (int) : min=0 max=255 step=1 default=120 value=120
    hue (int) : min=-127 max=127 step=1 default=0 value=0
    gamma (int) : min=1 max=8 step=1 default=5 value=5
    gain (int) : min=0 max=65535 step=1 default=16 value=16
    power_line_frequency (menu) : min=0 max=2 default=1 value=1
    sharpness (int) : min=0 max=255 step=1 default=3 value=3

    查看当前摄像头支持的视频压缩格式

    sudo v4l2-ctl -d /dev/video0 --list-formats
    
    • 1

    ioctl: VIDIOC_ENUM_FMT Index : 0
    Type : Video Capture
    Pixel Format: ‘MJPG’ (compressed)
    Name : Motion-JPEG

    查看摄像头所支持的分辨率

     sudo v4l2-ctl --list-framesizes=MJPG -d /dev/video0
    
    • 1

    ioctl: VIDIOC_ENUM_FRAMESIZES
    Size: Discrete 800x600
    Size: Discrete 352x288
    Size: Discrete 320x240
    Size: Discrete 640x480

    v4l2-ctl 命令

    v4l2-ctl help
    
    • 1

    General/Common options:
    –all display all information available
    -C, --get-ctrl=[,…]
    get the value of the controls [VIDIOC_G_EXT_CTRLS]
    -c, --set-ctrl==[,=…]
    set the value of the controls [VIDIOC_S_EXT_CTRLS]
    -D, --info show driver info [VIDIOC_QUERYCAP]
    -d, --device= use device instead of /dev/video0
    if starts with a digit, then /dev/video is used
    -e, --out-device= use device for output streams instead of the
    default device as set with --device
    if starts with a digit, then /dev/video is used
    -h, --help display this help message
    –help-all all options
    –help-io input/output options
    –help-misc miscellaneous options
    –help-overlay overlay format options
    –help-sdr SDR format options
    –help-selection crop/selection options
    –help-stds standards and other video timings options
    –help-streaming streaming options
    –help-tuner tuner/modulator options
    –help-vbi VBI format options
    –help-vidcap video capture format options
    –help-vidout vidout output format options
    –help-edid edid handling options
    -k, --concise be more concise if possible.
    -l, --list-ctrls display all controls and their values [VIDIOC_QUERYCTRL]
    -L, --list-ctrls-menus
    display all controls and their menus [VIDIOC_QUERYMENU]
    -r, --subset=[,,]+
    the subset of the N-dimensional array to get/set for control ,
    for every dimension an (, ) tuple is given.
    -w, --wrapper use the libv4l2 wrapper library.
    –list-devices list all v4l devices
    –log-status log the board status in the kernel log [VIDIOC_LOG_STATUS]
    –get-priority query the current access priority [VIDIOC_G_PRIORITY]
    –set-priority=
    set the new access priority [VIDIOC_S_PRIORITY]
    is 1 (background), 2 (interactive) or 3 (record)
    –silent only set the result code, do not print any messages
    –sleep= sleep , call QUERYCAP and close the file handle
    –verbose turn on verbose ioctl status reporting

    2 V4L2驱动的ioctl功能详情

  • 相关阅读:
    TI mmWave radar sensors Tutorial 笔记 | Module 2: The phase of the IF signal
    BeanUtils.copyProperties的使用场景
    Self-supervised Low Light Image Enhancement and Denoising 论文阅读笔记
    Vue路由与nodejs环境搭建
    SpringMVC
    Android13-图片视频选择器
    面向对象-01我的世界
    右击显示Pycharm打开教程
    iptables不同网段的ip转发
    【docker容器技术与K8s】
  • 原文地址:https://blog.csdn.net/qq_50808730/article/details/125503978