[Cin] Record camcorder video stream via v4l2 and hdmi-usb3 capture as input device

Terje J. Hanssen terjejhanssen at gmail.com
Thu May 29 18:36:45 CEST 2025



Den 29.05.2025 04:45, skrev Terje J. Hanssen:
>
>
> Den 29.05.2025 01:27, skrev Andrew Randrianasulu:
>>
>>
>> ср, 28 мая 2025 г., 23:38 Terje J. Hanssen <terjejhanssen at gmail.com>:
>>
>>
>>
>>     Den 27.05.2025 21:29, skrev Andrew Randrianasulu:
>>     > On Tue, May 27, 2025 at 10:47 PM Terje J. Hanssen
>>     > <terjejhanssen at gmail.com> wrote:
>>     >> Den 27.05.2025 16:28, skrev Andrew Randrianasulu:
>>     >>
>>     >> On Tue, May 27, 2025 at 7:02 PM Terje J. Hanssen via Cin
>>     >> <cin at lists.cinelerra-gg.org> wrote:
>>     >>
>>     >>
>>     >> Den 27.05.2025 12:54, skrev Terje J. Hanssen:
>>     >>
>>     >> I tried to Record camcorder video stream via v4l2 and
>>     hdmi-usb3 capture as input device.
>>     >>
>>     >> ms2130 is more powerful but else similar to the usb2 EasyCap
>>     device example described in the CinGG manual
>>     >>
>>     https://cinelerra-gg.org/download/CinelerraGG_Manual/Use_Case_1_a_EasyCap.html
>>     >>
>>     >> My Sony FX7-E 1080i50 HDV camcorder was connected via HDMI to
>>     a ms2130 usb3 capture card.
>>     >>
>>     >> My procedure description here on openSUSE Tumbleweed-Slowroll,
>>     kernel 6.12.30-1.0.4.sr20250501-longterm
>>     >>
>>     >> ~/Applications> ./CinGG-20250430-x86_64.AppImage
>>     >> Cinelerra Infinity - built: Apr 30 2025 07:18:32
>>     >>
>>     >> 1) Settings > Preferences > Record
>>     >>
>>     >> File format: FFMPEG     mp4
>>     >>
>>     >> Video In:
>>     >>
>>     >> Record driver: Video4Linux2 /dev(video0
>>     >>
>>     >> The first thing I noticed was that default Record video
>>     setting was SD NTSC, not PAL as else according to my time zone.
>>     >> Could this possibly be changed as else?
>>     >>
>>     >> Frames to record on disk: 30 (default)?
>>     >>
>>     >> Changed frame to a camcorder resolution and fps supported by
>>     v4l2 and ms2130:
>>     >>
>>     >> Frame: 1920 x 1080 (was default NTSC SD)
>>     >> fps: 50 (progressive)
>>     >>
>>     >>
>>     >> File > Record r
>>     >>
>>     >> Two windows opened, one showing the running record time etc.
>>     and the other the camera window image.
>>     >>
>>     >>
>>     >> Unhappily, when I reconnected the camcorder to re-test today,
>>     the second window with the camera image did not longer open!!
>>     >> I've tried to reset the machine and camcorder, but no. Did
>>     also a test with system ffplay (when the v4l2 was free again) and
>>     it worked.
>>     >>
>>     >> Obviously here is something that causes this confusing issue,
>>     but what?  load straty, a changed setting or something else?
>>     >> Happily the window opened yesterday, so I know the should work.
>>     >> I understand this can be difficult to troubleshoot without a
>>     similar setup.
>>     >>
>>     >> There is checkbox named Monitor Video. Be sure you have it  set.
>>     >>
>>     >>
>>     >> Yes, thanks it works again.
>>     >>
>>     >> I usually set all parameters (like frame size, framerate, type of
>>     >> Video Input device) in Recording tab.
>>     >>
>>     >>
>>     >> Yes, but I wonder what these default box values mean?
>>     >>
>>     >> Frames to record to disk at a time: 30
>>     >> Frames to buffer in device: 2
>>     >> Positioning: Software timing
>>     > I left first two as defaults, and sometimes for screenrecording set
>>     > Samples instead of Software timing (so it will write stream
>>     relative
>>     > to audio samples, adding or dropping frames as needed - makes audio
>>     > and video track match)
>>     >
>>     > There should be std. for cingg wrench icon where you select type of
>>     > encoding (FFMPEG ..).
>>     > If you click it you get window with compression parameters.
>>     > I set Pixels there.
>>
>>
>>     Yeah, thank you - now it's hopefully better in my fingers :)
>>
>>     First, with my Sony FX7E HDV 1080i50 camera connected via
>>     HDMI-ms2130-USB3 - 4vl2
>>
>>     That is the camera's EIP native (w/o MPEG-2 compression) output
>>     via HDMI
>>     handshake expected FHD 1080i 422,
>>     or is it just the ms2130 via USB3 and v4l2 capability that is
>>     detected
>>     below?
>>
>>
>>
>> Very good question. HDMI is (uncompressed) digital video interface, 
>> likewise USB3 is also digital, BUT as we noted in another thread by 
>> default ms2130 does its own signal processing, but with hacked 
>> firmware this can be disabled and thus this usb3 dongle become sort 
>> of generic digital input device at relatively high speed (75 Mbytes/s).
>>
>> Unless you set your camera as giant "webcam" I think that is on HDMI 
>> output is result of decoding mpeg2 from tape?
>
> My tests here were just camera without tape. I'll have a look with 
> tape playing to find the bitrate over HDMI out.


Recording test from FX7E 1080i50 HDV tape playing uncompressed stream 
and encoding to ffv1.mkv video + pcm_s16le audio
     - without specifying input or output formats or video size, to see 
what are detected default:

As seen the input bitrate: 1658880 kb/s is the same extreme high (like 
from pure camera recording without tape), possibly it is the ms2130 
capability
The output has bitrate=212106.6kbits/s speed=0.998x, locked by realtime 
playing the tape

ffmpeg -hide_banner -f v4l2 -framerate 50 -i /dev/video0 -f alsa -ac 2 
-i hw:CARD=UHD,DEV=0 -c:v ffv1 -level 3 -c:a pcm_s16le -t 10 
hdv1080i_tape_50fps+alsa_pcm_ffv1-3.mkv

Input #0, video4linux2,v4l2, from '/dev/video0':
   Duration: N/A, start: 202.328326, bitrate: 1658880 kb/s
   Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 
1658880 kb/s, 50 fps, 50 tbr, 1000k tbn
[aist#1:0/pcm_s16le @ 0x55693a836280] Guessed Channel Layout: stereo
Input #1, alsa, from 'hw:CARD=UHD,DEV=0':
   Duration: N/A, start: 1747334099.278505, bitrate: 1536 kb/s
   Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo (native) -> ffv1 (native))
   Stream #1:0 -> #0:1 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help

Output #0, matroska, to 'hdv_50fps+alsa_pcm_ffv1-3.mkv':
   Metadata:
     encoder         : Lavf61.7.100
   Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv422p(tv, 
progressive), 1920x1080, q=2-31, 200 kb/s, 50 fps, 1k tbn
       Metadata:
         encoder         : Lavc61.19.101 ffv1
   Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 
stereo, s16, 1536 kb/s
       Metadata:
         encoder         : Lavc61.19.101 pcm_s16le
[out#0/matroska @ 0x55693a836400] video:257003KiB audio:1875KiB 
subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 
0.016085%

frame=  500 fps= 50 q=-0.0 Lsize=  258919KiB time=00:00:10.00 
bitrate=212106.6kbits/s speed=0.998x


>
> And to repeat the relevant sections from to Steve Mullen's FX7 and V1 
> handbook:
>
> When the camera is operating, the EIP generates uncompressed 
> 1440x1080i with a 4:2:2 color space.
> Digital 4:2:2 data are output via the HDMI port
> Therefore, you can record 4:2:2 live HD video from the camera without 
> MPEG-2 compression.
>
> Two-channel audio is output on the HDMI port, both when the camera is 
> running and during tape
> playback.
> The Sony V1 and FX7 provide an HDMI output port that carries 
> uncompressed 4:2:2, 8-bit,
> digital video plus dual-channel, PCM, 16-bit, 48kHz audio.
>
> If you record to HDV tape, you can also benefit from HDMI uncompressed 
> capture and editing.
> After MPEG-2 decoding, the 4:2:2, 8-bit YCbCr uncompressed video is 
> sent via the camcorder’s
> HDMI port
>
> If you are playing a 1080i50 or 1080i60 HDV tape. The 4:2:0 MPEG-2 is 
> decoded and chroma up-scaled to a 4:2:2.
> The HDMI chip downscales 1440 to 1280 while it up-scales 540 to 720.
> The result is 720p50 or 720p60, which is output via HDMI.
>
>
>>
>>
>>
>>     ffplay -hide_banner -f v4l2 -framerate 50 -i /dev/video0
>>     Input #0, video4linux2,v4l2, from '/dev/video0':B sq= 0B
>>        Duration: N/A, start: 290.793132, bitrate: 1658880 kb/s
>>        Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422,
>>     1920x1080,
>>     1658880 kb/s, 50 fps, 50 tbr, 1000k tbn
>>
>>     v4l2-ctl -V
>>     Format Video Capture:
>>          Width/Height      : 1920/1080
>>          Pixel Format      : 'YUYV' (YUYV 4:2:2)
>>          Field             : None
>>          Bytes per Line    : 3840
>>          Size Image        : 4147200
>>          Colorspace        : sRGB
>>          Transfer Function : Rec. 709
>>          YCbCr/HSV Encoding: ITU-R 601
>>          Quantization      : Default (maps to Limited Range)
>>          Flags             :
>>
>>     -----------------
>>
>>     So I tested two additional mpeg2-hdv and mpeg2_hq recordings with
>>     CinGG
>>     that works ok:
>>
>>     1) mpeg2_hdv_mpeg + mp2
>>     ---------------------------------------------
>>     1920X1080
>>     50fps
>>     mpeg1_mp2.mpeg (no PCM available)
>>     mpeg2_hdv_mpeg
>>     yuv422p (default yuv420, shouldn't 422 be detected automatic from
>>     the
>>     input?)
>>
>>
>> I think capture logic predates ffmpeg integration, so not sure if it 
>> possible .. I'll look into it.
>>
>>
>>
>>     BC_DisplayInfo::gl_fb_config failed
>>     DeviceV4L2Base::v4l2_open pixels="YUYV"; res="1920x1080 1600x1200
>>     1360x768 1280x1024 1280x960 1280x720 1024x768 800x600 720x576
>>     720x480
>>     640x480"
>>     v4l2 s_fmt 1920x1080 YUYV
>>     DeviceV4L2Base::v4l2_open VIDIOC_S_STD: Unsuitable«ioctl» for device
>>     -------
>>
>>     ffprobe -hide_banner CinGG_Record_mpeg2_hdv_video+mp2_audio.mpeg
>>     Input #0, mpeg, from 'CinGG_Record_mpeg2_hdv_video+mp2_audio.mpeg':
>>        Duration: 00:00:09.31, start: 0.509978, bitrate: 25439 kb/s
>>        Stream #0:0[0x1e0]: Video: mpeg2video (4:2:2), yuv422p(tv,
>>     bt709/unknown/unknown, progressive), 1920x1080 [SAR 1:1 DAR
>>     16:9], 50
>>     fps, 50 tbr, 90k tbn
>>            Side data:
>>              cpb: bitrate max/min/avg: 0/0/0 buffer size: 7110656
>>     vbv_delay: N/A
>>        Stream #0:1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s
>>     -------
>>
>>     My comments:
>>     The default 25Mbps video bitrate is just like mpeg2/ MP at H-14 HDV
>>     1080i50
>>     420 on tape.
>>     Max allowed is 60 Mbps
>>     PCM audio is missing
>>
>>     ============
>>
>>     2) mpeg2_hq_mpeg + mp2
>>     -------------------------------------------
>>     1920X1080
>>     50fps
>>     mpeg1_mp2.mpeg (no PCM available)
>>     mpeg2_hq_mpeg
>>     yuv422p (default yuv420, shouldn't 422 be detected automatic from
>>     the
>>     input?)
>>
>>     DeviceV4L2Base::v4l2_open pixels="YUYV"; res="1920x1080 1600x1200
>>     1360x768 1280x1024 1280x960 1280x720 1024x768 800x600 720x576
>>     720x480
>>     640x480"
>>     v4l2 s_fmt 1920x1080 YUYV
>>     DeviceV4L2Base::v4l2_open VIDIOC_S_STD: Unsuitable«ioctl» for device
>>     -----------
>>
>>     ffprobe -hide_banner CinGG_Record_mpeg2_hq_video+mp2_audio.mpeg
>>     Input #0, mpeg, from 'CinGG_Record_mpeg2_hq_video+mp2_audio.mpeg':
>>        Duration: 00:00:11.55, start: 0.509978, bitrate: 6379 kb/s
>>        Stream #0:0[0x1e0]: Video: mpeg2video (4:2:2), yuv422p(tv,
>>     bt709/unknown/unknown, progressive), 1920x1080 [SAR 1:1 DAR
>>     16:9], 50
>>     fps, 50 tbr, 90k tbn
>>            Side data:
>>              cpb: bitrate max/min/avg: 0/0/0 buffer size: 1130496
>>     vbv_delay: N/A
>>        Stream #0:1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s
>>     ------
>>     My comments:
>>     The default 6.37Mbps video bitrate is not very "hq", more like a
>>     SD DVD
>>     bitrate
>>     PCM audio is missing
>>
>>     =====================
>>
>>     Sometime in the future, additional presets (especial 422p) from
>>     common
>>     MPEG-2 Profile/Level combinations could be useful
>>     https://en.wikipedia.org/wiki/H.262/MPEG-2_Part_2#Video_profiles_and_levels
>>
>>
>>
>> PCM in mpeg2ts tend to be unsupported? It stuffed into private stream 
>> and even ffmpeg itself does not know how to extract it back?  So if 
>> you want to put video+audio back to tape you are stuck with that 
>> camera itself produces .... If you prepare files for PC viewing you 
>> can encode in any codec/audio codec/container combination.
>
> HDV 1080i 25Mbps (M2T) compressed on miniDV tapes has only space for 
> embedded MP2 audio, HDV 720p optional PCM.
> Else, "HDV" in various MPEG-2 formats can be stored with PCM audio, 
> included DVD and Bluray..
> All XDCAM video formats use MPEG-2 and PCM audio
> https://en.wikipedia.org/wiki/XDCAM#XDCAM_formats
>
>> Feel free to modify some presets, and I think there was way to save 
>> them from GUI?
>
> I'll look at that
>
>>
>> Obvious question that tended to bite me back in the day: does audio 
>> and video stay in sync over longer periods of time?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>     >> I have yet to find where to set color subsampling yuv422p,
>>     bitrate, quality profile etc
>>     >>
>>     >> I recorded three test file types with their defaults, and all
>>     got yuv420p
>>     >>
>>     >> CinGG_Record1.mp4
>>     >> Duration: 00:00:09.05, start: 0.000000, bitrate: 5044 kb/s
>>     >> Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661),
>>     yuv420p(tv, bt709/unknown/unknown, progressive), 1920x1080, 4952
>>     kb/s, 50 fps, 50 tbr, 12800 tbn (default)
>>     >>
>>     >> CinGG_Record2.mkv
>>     >> Duration: 00:00:13.66, start: -0.007000, bitrate: 890 kb/s
>>     >> Stream #0:0: Video: vp9 (Profile 0), yuv420p(tv,
>>     bt709/unknown/unknown), 1920x1080, 50 fps, 50 tbr, 1k tbn
>>     >>
>>     >> CinGG_Record3.mpeg
>>     >> Duration: 00:00:22.26, start: 0.520000, bitrate: 2321 kb/s
>>     >>    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv,
>>     bt709/unknown/unknown, progressive), 1920x1080 [SAR 1:1 DAR
>>     16:9], 50 fps, 50 tbr, 90k tbn
>>     >>
>>     >>
>>     >>
>>     >> Note that in your case while you record SD it gets upscaled by
>>     your
>>     >> svideo -> hdmi and  hdmi to usb converters to 1080p50
>>     >>
>>     >> There is red button and above it filename input field. Put
>>     >> path/filename there, hit Record, and it should start recording
>>     to that
>>     >> file.
>>     >>
>>     >> In case  you played with contrast/brightness settings (cingg
>>     uses its
>>     >> own set for v4l devices) you can run guvcview and restore them to
>>     >> their default values
>>     >>
>>     >>
>>     >>
>>     >>
>>     >>
>>     >>
>>     >>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20250529/adce1c82/attachment-0001.htm>


More information about the Cin mailing list