脳汁portal

アメリカ在住(だった)新米エンジニアがその日学んだIT知識を書き綴るブログ

USBカメラの解像度等の情報を確認する方法

deviceの確認

まずはカメラを接続したらlsusbで認識されているか確認します

$ lsusb
Bus 001 Device 005: ID 288c:0002  # <== これが追加された
Bus 001 Device 007: ID 05ac:0222 Apple, Inc. Aluminum Keyboard (JIS)
Bus 001 Device 006: ID 04ca:0061 Lite-On Technology Corp.
Bus 001 Device 004: ID 05ac:1006 Apple, Inc. Hub in Aluminum Keyboard
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

今回はBus 001 Device 005にUSBカメラが設定されています。
このときカメラの製造元や会社の名前が出てくるときと出てこない場合があります

各項目の確認

概要確認
$ v4l2-ctl -d 0 --info
Driver Info (not using libv4l2):
        Driver name   : uvcvideo
        Card type     : MS-M103HU
        Bus info      : usb-3f980000.usb-1.5
        Driver version: 4.4.11
        Capabilities  : 0x84200001
                Video Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps   : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format
全項目確認
$ v4l2-ctl -d 0 --all
Driver Info (not using libv4l2):
        Driver name   : uvcvideo
        Card type     : MS-M103HU
        Bus info      : usb-3f980000.usb-1.5
        Driver version: 4.4.11
        Capabilities  : 0x84200001
                Video Capture
                Streaming
                Extended Pix Format
・
・
・
対応解像度&FPS確認
$ v4l2-ctl -d 0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
        Index       : 0
        Type        : Video Capture
        Pixel Format: 'YUYV'
        Name        : YUYV 4:2:2
                Size: Discrete 1280x720
                        Interval: Discrete 0.083s (12.000 fps)

        Index       : 1
        Type        : Video Capture
        Pixel Format: 'MJPG' (compressed)
        Name        : Motion-JPEG
                Size: Discrete 1280x720
                        Interval: Discrete 0.033s (30.000 fps)
lsusbでも確認できる
$ lsusb -s 001:005 -v | egrep "Width|Height"
Couldn't open device, some information will be missing
        wWidth                           1280
        wHeight                           720
        wWidth( 0)                       1280
        wHeight( 0)                       720
        wWidth                           1280
        wHeight                           720
        wWidth( 0)                       1280
        wHeight( 0)                       720