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

1.v4l2-ctl 常用操作

安装V4l2工具包

sudo apt install v4l-utils

通过v4l2查看摄像头设备

sudo v4l2-ctl --list-devices

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
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

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

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

v4l2-ctl 命令

v4l2-ctl help

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功能详情

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

常驻客栈

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值