vladimirvivien / go4vl

A Go library for working with the Video for Linux API (V4L2).
MIT License
228 stars 42 forks source link

Add support for YUYV #3

Open julian59189 opened 2 years ago

julian59189 commented 2 years ago

Currently only MJPEG is supported but it would be great if there was support for the YUYV format. Showing:

2021/07/31 15:35:43 setting format to 640x480 YUYV
2021/07/31 15:35:43 device or resource busy
exit status 1

Sample camera settings:


    Driver name      : ov534
    Card type        : USB Camera-B4.09.24.1
    Bus info         : usb-3f980000.usb-1.5
    Driver version   : 5.10.17
    Capabilities     : 0x85200001
        Video Capture
        Read/Write
        Streaming
        Extended Pix Format
        Device Capabilities
    Device Caps      : 0x05200001
        Video Capture
        Read/Write
        Streaming
        Extended Pix Format
Priority: 2
Video input : 0 (ov534: ok)
Format Video Capture:
    Width/Height      : 640/480
    Pixel Format      : 'YUYV' (YUYV 4:2:2)
    Field             : None
    Bytes per Line    : 1280
    Size Image        : 614400
    Colorspace        : sRGB
    Transfer Function : Default (maps to sRGB)
    YCbCr/HSV Encoding: Default (maps to ITU-R 601)
    Quantization      : Default (maps to Limited Range)
    Flags             :
Streaming Parameters Video Capture:
    Capabilities     : timeperframe
    Frames per second: 30.000 (30/1)
    Read buffers     : 2````
vladimirvivien commented 2 years ago

@julian59189 awesome. Thanks for the detail issue. This will be top priority to get out soon.

julian59189 commented 1 year ago

Hi @vladimirvivien any update on this?

vladimirvivien commented 1 year ago

Hi @julian59189 There has been a lot of changes since that time. If you get a chance, try the latest release, let me know if this is still an issue for you.

dschissler commented 6 months ago

I'm unable to get "webcam" and "snapshot" to work on a RPI 4B, and PS3 Eye. These are old cameras, but they're still abundant and popular.

v4l2Device Info:
    Driver name              : ov534
    Card name                : USB Camera-B4.09.24.1
    Bus info                 : usb-0000:01:00.0-1.2
    Driver version           : v6.1.58
    Driver capabilities : 85200001
        video capture (single-planar)
        extended pixel format
        read/write IO
        streaming IO
        device capabilities
    v4l2Device capabilities : 85200001
        video capture (single-planar)
        extended pixel format
        read/write IO
        streaming IO
Video input: 0 (ov534 : ok)
Video format for capture (default):
    Width x Height           : 640 x 480
    Pixel format             : YUYV 4:2:2
    Field                    : none
    Bytes per line           : 1280
    Size image               : 614400
    Colorspace               : sRGB
    Transfer function        : Default (map to Rec. 709)
    YCbCr/HSV encoding       : Default (map to ITU-R 601)
    Quantization             : Default (map to Limited range)
Supported formats:
    [0] 8-bit Bayer GRGR/BGBG : Sizes: [320x240] [640x480] 
    [1] YUYV 4:2:2           : Sizes: [320x240] [640x480] 
Crop capability for video capture:
    Bounds:                  : left=0; top=0; width=0; heigh=0
    Default:                 : left=0; top=0; width=0; heigh=0
    Pixel aspect             : 0/0
Stream capture parameters:
    Capability               : time per frame
    Capture mode             : not specified
    Frames per second        : 30/1
    Read buffers             : 2