linux usb摄像头设备信息查看

linux下usb摄像头操作,离不开v4l2框架
V4L2是Video for linux2的简称,为linux中关于视频设备的内核驱动。在Linux中,视频设备是设备文件,可以像访问普通文件一样对其进行读写,摄像头在/dev/video0下。

  • 查看linux 摄像头设备,如果存在有效的摄像头设备,则可以在dev目录下查看
eric@eric-PC:/$ ls dev/video* -l
crw-rw----+ 1 root video 81, 0 11月  8 13:37 dev/video0
crw-rw----+ 1 root video 81, 1 11月  8 13:37 dev/video1
  • 也可以查看启动信息,是否存在有效usb摄像头设备
eric@eric-PC:/$ dmesg | grep video
[ 1849.908486] videodev: Linux video capture interface: v2.00
[ 1850.022954] uvcvideo: Found UVC 1.00 device hm1091_techfront (0408:1020)
[ 1850.061899] uvcvideo 1-1:1.0: Entity type for entity Extension 4 was not initialized!
[ 1850.061903] uvcvideo 1-1:1.0: Entity type for entity Extension 3 was not initialized!
[ 1850.061905] uvcvideo 1-1:1.0: Entity type for entity Processing 2 was not initialized!
[ 1850.061907] uvcvideo 1-1:1.0: Entity type for entity Camera 1 was not initialized!
[ 1850.062579] usbcore: registered new interface driver uvcvideo

v4l2-ctl命令查看video设备参数信息,如果提示如下未找到v4l2-ctl命令,则需要安装v4l-utils

eric@eric-PC:/dev$ v4l2-ctl -d  /dev/video0 --all
bash: v4l2-ctl:未找到命令  
eric@eric-PC:/dev$ sudo apt-get install v4l-utils
eric@eric-PC:/$ v4l2-ctl -d  /dev/video0 --all
Driver Info:
        Driver name      : uvcvideo
        Card type        : hm1091_techfront: hm1091_techfr
        Bus info         : usb-0000:02:04.0-1
        Driver version   : 5.4.50
        Capabilities     : 0x84a00001
                Video Capture
                Metadata 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      : 1280/720
        Pixel Format      : 'MJPG' (Motion-JPEG)
        Field             : None
        Bytes per Line    : 0
        Size Image        : 1843200
        Colorspace        : sRGB
        Transfer Function : Default (maps to sRGB)
        YCbCr/HSV Encoding: Default (maps to ITU-R 601)
        Quantization      : Default (maps to Full Range)
        Flags             : 
Crop Capability Video Capture:
        Bounds      : Left 0, Top 0, Width 1280, Height 720
        Default     : Left 0, Top 0, Width 1280, Height 720
        Pixel Aspect: 1/1
Selection: crop_default, Left 0, Top 0, Width 1280, Height 720, Flags: 
Selection: crop_bounds, Left 0, Top 0, Width 1280, Height 720, Flags: 
Streaming Parameters Video Capture:
        Capabilities     : timeperframe
        Frames per second: 30.000 (30/1)
        Read buffers     : 0
                     brightness 0x00980900 (int)    : min=-64 max=64 step=1 default=0 value=0
                       contrast 0x00980901 (int)    : min=0 max=95 step=1 default=0 value=0
                     saturation 0x00980902 (int)    : min=0 max=100 step=1 default=64 value=64
                            hue 0x00980903 (int)    : min=-2000 max=2000 step=1 default=0 value=0
 white_balance_temperature_auto 0x0098090c (bool)   : default=1 value=1
                          gamma 0x00980910 (int)    : min=100 max=300 step=1 default=100 value=100
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=1 value=1
      white_balance_temperature 0x0098091a (int)    : min=2800 max=6500 step=1 default=4600 value=4600 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=7 step=1 default=2 value=2
         backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default=1 value=1
                  exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=3 value=3
              exposure_absolute 0x009a0902 (int)    : min=10 max=2047 step=1 default=384 value=384 flags=inactive
         exposure_auto_priority 0x009a0903 (bool)   : default=0 value=1

有以上信息可以看出,设备支持分辨率1280×720,支持MJPEG格式。


猜你喜欢

转载自blog.csdn.net/pyt1234567890/article/details/109558644