Cheshire Cat
Cheshire Cat

Reputation: 55

How get metadata from v4l2 usb camera?

So i have this IR camera (MaAnt SuperCam) with garbage software for Windows only (I had a lot of problems with this one, but it's not the topic). There are buttons to make shot or record video but they does not work.

I need to record images/video for further analysis (academic usage). My first concept was to shot print-screens of camera's software, so I can extract temperatures. To make shot I use modified USB keyboard that just hits print screen button, but there was to big delay on camera image, so it didn't work.

So, my second idea was to record video. I built simple device that turns on liht bulb so I can see on the record that this is the moment. But I found recording screen to be too hard for this PC.

So I came back to my previously rejected idea - to use this camera on linux and record video civilized way. I rejected this idea due to no temperature bar.

The image I get using VLC (/dev/video2) as been attached:

Ir output

Lack of knowing max/min temp. might be problem since I wan't to record temperature changes while (some) process.

I can workaround this by setting everything (in camera) to constant (disable auto white balance and whaterver) record something at temp. ie. 40 and 80C and just stick to that knowing what gray is 40 and what is 80. You know what I mean ;)

But this should possible somehow easier - I hope.

TL; DR So, I have this IR camera (-15-150C) with garbage Windows software and I would like to try Linux power. I need to measure temperature changes. Is there any way to extract some (maybe useful) info from v4l2 metadata?

san@lato:~$ v4l2-ctl -d /dev/video2 --stream-mmap --all
Driver Info:
        Driver name      : uvcvideo
        Card type        : USB Camera: USB Camera
        Bus info         : usb-0000:00:14.0-1
        Driver version   : 5.15.131
        Capabilities     : 0x84a00001
                Video Capture
                Metadata Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : uvcvideo
        Model            : USB Camera: USB Camera
        Serial           : 200901010001
        Bus info         : usb-0000:00:14.0-1
        Media version    : 5.15.131
        Hardware revision: 0x00001303 (4867)
        Driver version   : 5.15.131
Interface Info:
        ID               : 0x03000002
        Type             : V4L Video
Entity Info:
        ID               : 0x00000001 (1)
        Name             : USB Camera: USB Camera
        Function         : V4L2 I/O
        Flags            : default
        Pad 0x01000007   : 0: Sink
          Link 0x02000010: from remote pad 0x100000a of entity 'Extension 4' (Video Pixel Formatter): Data, Enabled, Immutable
Priority: 2
Video input : 0 (Input 1: ok)
Format Video Capture:
        Width/Height      : 256/192
        Pixel Format      : 'YUYV' (YUYV 4:2:2)
        Field             : None
        Bytes per Line    : 512
        Size Image        : 98304
        Colorspace        : sRGB
        Transfer Function : Rec. 709
        YCbCr/HSV Encoding: ITU-R 601
        Quantization      : Default (maps to Limited Range)
        Flags             : 
Crop Capability Video Capture:
        Bounds      : Left 0, Top 0, Width 256, Height 192
        Default     : Left 0, Top 0, Width 256, Height 192
        Pixel Aspect: 1/1
Selection Video Capture: crop_default, Left 0, Top 0, Width 256, Height 192, Flags: 
Selection Video Capture: crop_bounds, Left 0, Top 0, Width 256, Height 192, Flags: 
Streaming Parameters Video Capture:
        Capabilities     : timeperframe
        Frames per second: 25.000 (25/1)
        Read buffers     : 0

User Controls

                     brightness 0x00980900 (int)    : min=-64 max=64 step=1 default=0 value=0
                       contrast 0x00980901 (int)    : min=0 max=100 step=1 default=50 value=50
                     saturation 0x00980902 (int)    : min=0 max=100 step=1 default=64 value=64
                            hue 0x00980903 (int)    : min=-180 max=180 step=1 default=0 value=0
        white_balance_automatic 0x0098090c (bool)   : default=1 value=1
                          gamma 0x00980910 (int)    : min=100 max=500 step=1 default=300 value=300
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=1 value=1 (50 Hz)
                                0: Disabled
                                1: 50 Hz
                                2: 60 Hz
      white_balance_temperature 0x0098091a (int)    : min=2800 max=6500 step=10 default=4600 value=4600 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=100 step=1 default=50 value=50
         backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default=0 value=0
<<<<<<<<<<<<<<<<<<<<<<<<< 24.41 fps, dropped buffers: 1
<<<<<<<<<<<<<<<<<<<<<<<<< 24.70 fps
<<<<<<<<<<<<<<<<<<<<<<<<< 24.80 fps
<<<<<<<<<<<<<<<<<<<<<<<<< 24.85 fps
<<<<^C
san@lato:~$ v4l2-ctl -d /dev/video3 --stream-mmap --all
Driver Info:
        Driver name      : uvcvideo
        Card type        : USB Camera: USB Camera
        Bus info         : usb-0000:00:14.0-1
        Driver version   : 5.15.131
        Capabilities     : 0x84a00001
                Video Capture
                Metadata Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04a00000
                Metadata Capture
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : uvcvideo
        Model            : USB Camera: USB Camera
        Serial           : 200901010001
        Bus info         : usb-0000:00:14.0-1
        Media version    : 5.15.131
        Hardware revision: 0x00001303 (4867)
        Driver version   : 5.15.131
Interface Info:
        ID               : 0x03000005
        Type             : V4L Video
Entity Info:
        ID               : 0x00000004 (4)
        Name             : USB Camera: USB Camera
        Function         : V4L2 I/O
Priority: 2
Format Metadata Capture:
        Sample Format   : 'UVCH' (UVC Payload Header Metadata)
        Buffer Size     : 1024
^C

san@lato:~$ v4l2-ctl -d /dev/video3 --get-fmt-meta-out
VIDIOC_G_FMT: failed: Invalid argument
san@lato:~$ v4l2-ctl -d /dev/video3 --list-formats-meta
ioctl: VIDIOC_ENUM_FMT
        Type: Metadata Capture

        [0]: 'UVCH' (UVC Payload Header Metadata)
san@lato:~$ v4l2-ctl -d /dev/video3 --get-fmt-meta
Format Metadata Capture:
        Sample Format   : 'UVCH' (UVC Payload Header Metadata)
        Buffer Size     : 1024
san@lato:~$ v4l2-ctl -d /dev/video3 --list-formats-meta-out
ioctl: VIDIOC_ENUM_FMT
        Type: Metadata Output

san@lato:~$ v4l2-ctl -d /dev/video3 --get-fmt-meta-out
VIDIOC_G_FMT: failed: Invalid argument

Upvotes: 0

Views: 772

Answers (0)

Related Questions