сб, 25 февр. 2023 г., 23:25 Terje J. Hanssen <terjejhanssen@gmail.com>:


Den 25.02.2023 19:27, skrev Andrew Randrianasulu:


сб, 25 февр. 2023 г., 21:19 Terje J. Hanssen via Cin <cin@lists.cinelerra-gg.org>:
So I have received the ms2130 HDMI-USB3 capture card. 
The A/D AV converter & SV-HDMI/adapter is not received so far, and I have not avialable my HDV camcorder (on service) to output HDMI video stream with.

Yet, I have initially run some verification tests on the ms2130 HDMI-USB3 UHD capture card alone, for what they are worth.

As "UHD" (and/or USB3) is mostly generic used to identify this card (while ms2130 almost not), the some output is piped and stripped with grep "UHD".

----------------

dmesg | grep UHD
[    2.798210] usb 2-5: Product: USB3.0 UHD
[    2.827772] hid-generic 0003:345F:2130.0005: hiddev97,hidraw4: USB HID v1.10 Device [MACROSILICON USB3.0 UHD] on usb-0000:00:14.0-5/input4
[    4.805554] usb 2-5: Found UVC 1.00 device USB3.0 UHD (345f:2130)


udevadm info  /dev/video* | egrep 'DEVNAME|ID_V4L_PRODUCT'
E: DEVNAME=/dev/video0
E: ID_V4L_PRODUCT=USB 2.0 Camera: HD 720P Webcam
E: DEVNAME=/dev/video1
E: ID_V4L_PRODUCT=USB 2.0 Camera: HD 720P Webcam
E: DEVNAME=/dev/video2
E: ID_V4L_PRODUCT=USB3.0 UHD: USB3.0 UHD
E: DEVNAME=/dev/video3
E: ID_V4L_PRODUCT=USB3.0 UHD: USB3.0 UHD


udevadm info  /dev/video* | egrep UHD
S: v4l/by-id/usb-MACROSILICON_USB3.0_UHD_20210623-video-index0
E: ID_V4L_PRODUCT=USB3.0 UHD: USB3.0 UHD
E: ID_MODEL=USB3.0_UHD
E: ID_MODEL_ENC=USB3.0\x20UHD
E: ID_SERIAL=MACROSILICON_USB3.0_UHD_20210623
E: DEVLINKS=/dev/v4l/by-id/usb-MACROSILICON_USB3.0_UHD_20210623-video-index0 /dev/v4l/by-path/pci-0000:00:14.0-usb-0:5:1.0-video-index0
S: v4l/by-id/usb-MACROSILICON_USB3.0_UHD_20210623-video-index1
E: ID_V4L_PRODUCT=USB3.0 UHD: USB3.0 UHD
E: ID_MODEL=USB3.0_UHD
E: ID_MODEL_ENC=USB3.0\x20UHD
E: ID_SERIAL=MACROSILICON_USB3.0_UHD_20210623
E: DEVLINKS=/dev/v4l/by-path/pci-0000:00:14.0-usb-0:5:1.0-video-index1 /dev/v4l/by-id/usb-MACROSILICON_USB3.0_UHD_20210623-video-index1


lsusb | grep UHD
Bus 002 Device 004: ID 345f:2130 MACROSILICON USB3.0 UHD

cat /proc/asound/cards | grep UHD
 2 [UHD            ]: USB-Audio - USB3.0 UHD
                      MACROSILICON USB3.0 UHD at usb-0000:00:14.0-5, super speed

ll /dev/video*
crw-rw----+ 1 root video 81, 0 feb.  25 14:15 /dev/video0
crw-rw----+ 1 root video 81, 1 feb.  25 14:15 /dev/video1
crw-rw----+ 1 root video 81, 2 feb.  25 14:15 /dev/video2
crw-rw----+ 1 root video 81, 3 feb.  25 14:15 /dev/video3

---------------------

v4l2-ctl --list-devices
USB 2.0 Camera: HD 720P Webcam (usb-0000:00:14.0-11):
        /dev/video0
        /dev/video1

USB3.0 UHD: USB3.0 UHD (usb-0000:00:14.0-5):
        /dev/video2
        /dev/video3

-----------

v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
        Index       : 0
        Type        : Video Capture
        Pixel Format: 'YUYV'
        Name        : YUYV 4:2:2
                Size: Discrete 640x480
                        Interval: Discrete 0.030s (33.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
                Size: Discrete 1280x720
                        Interval: Discrete 0.100s (10.000 fps)
                Size: Discrete 640x360
                        Interval: Discrete 0.030s (33.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
            ................
 Index       : 1
        Type        : Video Capture
        Pixel Format: 'MJPG' (compressed)
        Name        : Motion-JPEG
                Size: Discrete 640x480
                        Interval: Discrete 0.030s (33.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
                Size: Discrete 1280x720
                        Interval: Discrete 0.030s (33.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
                Size: Discrete 640x360
                        Interval: Discrete 0.030s (33.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
                       ......................


As the above doesn't list any 1920x1080 resolution, I wonder if it list just format for the usb2 webcam and not for ms2130 capture card?


Yeah, looking at how webcam listed first it makes sense. Try to instruct v4l2-ctl to use another device? (my guess it will be "-d" switch but I can be wrong! Manyal or "--help" output is better guide ..)

Be aware that "v4l2-ctl --list-formats-ext" was the same (I think) as used for the previous ms2109 Hama card, and I thought formats for all connected devices were listed then.
Obviously there is a default (or first device) used, when no device is specified, so thank you for the tip.

By help of google and "superuser" I found out that actually both "-D -d /dev/video2" are needed to get both frame sizes and fps listed:

v4l2-ctl -D -d /dev/video2 --list-formats-ext
Driver Info (not using libv4l2):
        Driver name   : uvcvideo
        Card type     : USB3.0 UHD: USB3.0 UHD
        Bus info      : usb-0000:00:14.0-5
        Driver version: 5.14.21
        Capabilities  : 0x84A00001
                Video Capture
                Metadata Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps   : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format
ioctl: VIDIOC_ENUM_FMT
        Index       : 0
        Type        : Video Capture
        Pixel Format: 'YUYV'
        Name        : YUYV 4:2:2
                Size: Discrete 1920x1080
                        Interval: Discrete 0.017s (60.000 fps)
                        Interval: Discrete 0.020s (50.000 fps)
                        Interval: Discrete 0.033s (30.000 fps)
                        Interval: Discrete 0.050s (20.000 fps)
                        Interval: Discrete 0.100s (10.000 fps)
                ............
                
                Size: Discrete 1280x720
                        Interval: Discrete 0.017s (60.000 fps)
                        Interval: Discrete 0.020s (50.000 fps)
                        Interval: Discrete 0.033s (30.000 fps)
                        Interval: Discrete 0.050s (20.000 fps)
                        Interval: Discrete 0.100s (10.000 fps)
                ...............
                
                Size: Discrete 720x576
                        Interval: Discrete 0.017s (60.000 fps)
                        Interval: Discrete 0.020s (50.000 fps)
                        Interval: Discrete 0.033s (30.000 fps)
                        Interval: Discrete 0.050s (20.000 fps)
                        Interval: Discrete 0.100s (10.000 fps)
               ................



-------------------------------------

Try also ffplay to list supported formats for a video4linux2 device:

ffplay -hide_banner -f v4l2 -list_formats all /dev/video2
[video4linux2,v4l2 @ 0x7f8280000cc0] Raw       :     yuyv422 :           YUYV 4:2:2 : 1920x1080 1600x1200 1360x768 1280x1024 1280x960 1280x720 1024x768 800x600 720x576 720x480 640x480
/dev/video2: Immediate exit requested
nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0


this one at least list all formats but not their framerates ...



ffplay -hide_banner -f v4l2 -list_formats all /dev/video3
[video4linux2,v4l2 @ 0x7f3bd0000cc0] ioctl(VIDIOC_G_INPUT): Inappropriate ioctl for device
/dev/video3: Inappropriate ioctl for device

-------------

I am not sure about what the following command really does, but it was described to

"Grab and record the input of a video4linux2 device, leave the frame rate and size as previously set:"

ffmpeg -hide_banner -f v4l2 -input_format yuyv422 -i /dev/video2 out_test.mpeg
    
[video4linux2,v4l2 @ 0x55c22212cfc0] Dequeued v4l2 buffer contains corrupted data (0 bytes).
Input #0, video4linux2,v4l2, from '/dev/video2':
  Duration: N/A, start: 0.000000, bitrate: 1990656 kb/s
  Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 1990656 kb/s, 60 fps, 60 tbr, 1000k tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg1video (native))
Press [q] to stop, [?] for help
[video4linux2,v4l2 @ 0x55c22212cfc0] Dequeued v4l2 buffer contains corrupted data (0 bytes).
    Last message repeated 30 times
[mpeg @ 0x55c22214f800] VBV buffer size not set, using default size of 230KB
If you want the mpeg file to be compliant to some specification
Like DVD, VCD or others, make sure you set the correct buffer size
Output #0, mpeg, to 'out_test.mpeg':
  Metadata:
    encoder         : Lavf59.27.100
  Stream #0:0: Video: mpeg1video, yuv420p(tv, progressive), 1920x1080, q=2-31, 200 kb/s, 60 fps, 90k tbn
    Metadata:
      encoder         : Lavc59.37.100 mpeg1video
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
frame= 1628 fps= 60 q=2.0 Lsize=    4702kB time=03:13:19.68 bitrate=   3.3kbits/s speed= 427x       
video:4675kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.572162%
Exiting normally, received signal 2.


try 30 fps instead of 60?

Like this?
But shouldn't a 422 and not a 420 output format be created?

it seems in some cases ffmpeg not geared towards preserving most information, just picks up most commonly defined/first pixel format. Try mpeg2video as output codec, and/or specify pixel format (pix_fmt) 
more explicitly before output's filename? Also you can try 'copy' video codec and meet absolutely enormous test file.

   
ffmpeg -hide_banner -f v4l2 -input_format yuyv422 -video_size 1920x1080 -framerate 30 -t 10 -i /dev/video2 out_1920x1024.mpeg
[video4linux2,v4l2 @ 0x564d7d7c3040] Dequeued v4l2 buffer contains corrupted data (0 bytes).
Input #0, video4linux2,v4l2, from '/dev/video2':
  Duration: N/A, start: 0.000000, bitrate: 995328 kb/s
  Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 995328 kb/s, 30 fps, 30 tbr, 1000k tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg1video (native))
Press [q] to stop, [?] for help
[video4linux2,v4l2 @ 0x564d7d7c3040] Dequeued v4l2 buffer contains corrupted data (0 bytes).
    Last message repeated 30 times
[mpeg @ 0x564d7d7e5a80] VBV buffer size not set, using default size of 230KB
If you want the mpeg file to be compliant to some specification
Like DVD, VCD or others, make sure you set the correct buffer size
Output #0, mpeg, to 'out_1920x1024.mpeg':
  Metadata:
    encoder         : Lavf59.27.100
  Stream #0:0: Video: mpeg1video, yuv420p(tv, progressive), 1920x1080, q=2-31, 200 kb/s, 30 fps, 90k tbn
    Metadata:
      encoder         : Lavc59.37.100 mpeg1video
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
frame=  301 fps= 30 q=1.6 Lsize=     896kB time=06:56:05.30 bitrate=   0.3kbits/s speed=2.47e+03x    
video:890kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.710403%

-----------
ffprobe -hide_banner out_1920x1024.mpeg
Input #0, mpeg, from 'out_1920x1024.mpeg':
  Duration: 00:00:10.03, start: 24955.333333, bitrate: 731 kb/s
  Stream #0:0[0x1e0]: Video: mpeg1video, yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 104857 kb/s, 30 fps, 30 tbr, 90k tbn

------------
mediainfo out_1920x1024.mpeg
General
Complete name                            : out_1920x1024.mpeg
Format                                   : MPEG-PS
File size                                : 896 KiB
Duration                                 : 10 s 33 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 732 kb/s

Video
ID                                       : 224 (0xE0)
Format                                   : MPEG Video
Format version                           : Version 1
Format settings, BVOP                    : No
Format settings, Matrix                  : Default
Format settings, GOP                     : N=12
Duration                                 : 10 s 33 ms
Bit rate mode                            : Variable
Bit rate                                 : 717 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 30.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.012
Time code of first frame                 : 00:00:00:00
Time code source                         : Group of pictures header
GOP, Open/Closed                         : Open
GOP, Open/Closed of first frame          : Closed
Stream size                              : 878 KiB (98%)