<div dir="auto"><div><br><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">ср, 7 мая 2025 г., 01:58 Terje J. Hanssen <<a href="mailto:terjejhanssen@gmail.com">terjejhanssen@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>

  
    
  
  <div>
    <br>
    <br>
    <div>Den 06.05.2025 22:54, skrev Andrew
      Randrianasulu:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="auto">
        <div><br>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">вт, 6 мая 2025 г., 23:49
              Terje J. Hanssen <<a href="mailto:terjejhanssen@gmail.com" target="_blank" rel="noreferrer">terjejhanssen@gmail.com</a>>:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div> <br>
                <br>
                <div>Den 05.05.2025 16:05, skrev Andrew Randrianasulu:<br>
                </div>
                <blockquote type="cite">
                  <div dir="auto">
                    <div><br>
                      <br>
                      <div class="gmail_quote">
                        <div dir="ltr" class="gmail_attr">пн, 5 мая 2025
                          г., 17:00 Andrew Randrianasulu <<a href="mailto:randrianasulu@gmail.com" rel="noreferrer noreferrer" target="_blank">randrianasulu@gmail.com</a>>:<br>
                        </div>
                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                          <div dir="auto">
                            <div><br>
                              <br>
                              <div class="gmail_quote">
                                <div dir="ltr" class="gmail_attr">пн, 5
                                  мая 2025 г., 16:26 Terje J. Hanssen
                                  via Cin <<a href="mailto:cin@lists.cinelerra-gg.org" rel="noreferrer noreferrer noreferrer" target="_blank">cin@lists.cinelerra-gg.org</a>>:<br>
                                </div>
                                <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                  <div> I consider to make a second
                                    preservation backup for archiving my
                                    Analog S-video and HDV footages on
                                    tapes to lossless compressed
                                    FFV1.MKV files stored on large USB3
                                    expansion disks. Also ffv1 HW
                                    (vulkan) decoding (next and encoding
                                    (later?) are of interest in this
                                    context.<br>
                                    <br>
                                    Related previous threads<br>
                                    <a href="https://www.mail-archive.com/cin@lists.cinelerra-gg.org/msg05547.html" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://www.mail-archive.com/cin@lists.cinelerra-gg.org/msg05547.html</a><br>
                                    <a href="https://www.mail-archive.com/cin@lists.cinelerra-gg.org/msg03791.html" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://www.mail-archive.com/cin@lists.cinelerra-gg.org/msg03791.html</a><br>
                                    <a href="https://www.mail-archive.com/cin@lists.cinelerra-gg.org/msg05547.html" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://www.mail-archive.com/cin@lists.cinelerra-gg.org/msg05547.html</a><br>
                                    <br>
                                    I adapt simply the last ffmpeg
                                    mpeg-2 code line to a first ffv1,
                                    version 3 test, 10 sec file<br>
                                    <br>
                                    ffmpeg -hide_banner -f v4l2
                                    -input_format yuyv422 -video_size
                                    720x576 -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
                                    720x576_50fps+alsa_ms2130_ffv1-3+pcm.mkv<br>
                                    <blockquote>Input #0,
                                      video4linux2,v4l2, from
                                      '/dev/video0':<br>
                                        Duration: N/A, start:
                                      351.803278, bitrate: 331776 kb/s<br>
                                        Stream #0:0: Video: rawvideo
                                      (YUY2 / 0x32595559), yuyv422,
                                      720x576, 331776 kb/s, 50 fps, 50
                                      tbr, 1000k tbn<br>
                                      [aist#1:0/pcm_s16le @
                                      0x555a99736cc0] Guessed Channel
                                      Layout: stereo<br>
                                      Input #1, alsa, from
                                      'hw:CARD=UHD,DEV=0':<br>
                                        Duration: N/A, start:
                                      1746445045.742179, bitrate: 1536
                                      kb/s<br>
                                        Stream #1:0: Audio: pcm_s16le,
                                      48000 Hz, stereo, s16, 1536 kb/s<br>
                                      Stream mapping:<br>
                                        Stream #0:0 -> #0:0 (rawvideo
                                      (native) -> ffv1 (native))<br>
                                        Stream #1:0 -> #0:1
                                      (pcm_s16le (native) ->
                                      pcm_s16le (native))<br>
                                      Press [q] to stop, [?] for help<br>
                                      Output #0, matroska, to
                                      '720x576_50fps+alsa_ms2130_ffv1-3+pcm.mkv':<br>
                                        Metadata:<br>
                                          encoder         : Lavf61.7.100<br>
                                        Stream #0:0: Video: ffv1 (FFV1 /
                                      0x31564646), yuv422p(tv,
                                      progressive), 720x576, q=2-31, 200
                                      kb/s, 50 fps, 1k tbn<br>
                                            Metadata:<br>
                                              encoder         :
                                      Lavc61.19.101 ffv1<br>
                                        Stream #0:1: Audio: pcm_s16le
                                      ([1][0][0][0] / 0x0001), 48000 Hz,
                                      stereo, s16, 1536 kb/s<br>
                                            Metadata:<br>
                                              encoder         :
                                      Lavc61.19.101 pcm_s16le<br>
                                      [out#0/matroska @ 0x555a99736f40]
                                      video:57467KiB audio:1875KiB
                                      subtitle:0KiB other streams:0KiB
                                      global headers:0KiB muxing
                                      overhead: 0.069226%<br>
                                      frame=  500 fps= 50 q=-0.0
                                      Lsize=   59383KiB time=00:00:10.00
                                      bitrate=48646.9kbits/s
                                      speed=0.998x <br>
                                    </blockquote>
                                    <br>
                                    ----------<br>
                                    <br>
                                    du -sh *<br>
                                    58M   
                                    720x576_50fps+alsa_ms2130_ffv1-3+pcm.mkv<br>
                                    <br>
                                    ----------<br>
                                    <br>
                                    ffprobe -hide_banner
                                    720x576_50fps+alsa_ms2130_ffv1-3+pcm.mkv<br>
                                    <blockquote>Input #0, matroska,webm,
                                      from
                                      '720x576_50fps+alsa_ms2130_ffv1-3+pcm.mkv':<br>
                                        Metadata:<br>
                                          ENCODER         : Lavf61.7.100<br>
                                        Duration: 00:00:10.00, start:
                                      0.000000, bitrate: 48646 kb/s<br>
                                        Stream #0:0: Video: ffv1 (FFV1 /
                                      0x31564646), yuv422p(tv,
                                      progressive), 720x576, 50 fps, 50
                                      tbr, 1k tbn<br>
                                            Metadata:<br>
                                              ENCODER         :
                                      Lavc61.19.101 ffv1<br>
                                              DURATION        :
                                      00:00:10.000000000<br>
                                        Stream #0:1: Audio: pcm_s16le,
                                      48000 Hz, 2 channels, s16, 1536
                                      kb/s<br>
                                            Metadata:<br>
                                              ENCODER         :
                                      Lavc61.19.101 pcm_s16le<br>
                                              DURATION        :
                                      00:00:10.000000000<br>
                                    </blockquote>
                                    <br>
                                    ------------        <br>
                                    <br>
                                    mediainfo
                                    720x576_50fps+alsa_ms2130_ffv1-3+pcm.mkv<br>
                                    <blockquote>General<br>
                                      Unique
                                      ID                               
                                      :
                                      158479793538002634101121179263279280827
(0x773A19163BEA6038DF448CE1529BB2BB)<br>
                                      Complete
                                      name                            :
720x576_50fps+alsa_ms2130_ffv1-3+pcm.mkv<br>
Format                                   : Matroska<br>
                                      Format
                                      version                          
                                      : Version 4<br>
                                      File
                                      size                               
                                      : 58.0 MiB<br>
Duration                                 : 10 s 0 ms<br>
                                      Overall bit rate
                                      mode                    : Variable<br>
                                      Overall bit
                                      rate                         :
                                      48.6 Mb/s<br>
                                      Frame
                                      rate                              
                                      : 50.000 FPS<br>
                                      Writing
                                      application                      :
                                      Lavf61.7.100<br>
                                      Writing
                                      library                          :
                                      Lavf61.7.100<br>
ErrorDetectionType                       : Per level 1<br>
                                      <br>
                                      Video<br>
ID                                       : 1<br>
Format                                   : FFV1<br>
                                      Format
                                      version                          
                                      : Version 3.4<br>
                                      Format settings, Slice
                                      count             : 4 slices per
                                      frame<br>
                                      Codec
                                      ID                                
                                      : V_MS/VFW/FOURCC / FFV1<br>
Duration                                 : 10 s 0 ms<br>
                                      Bit rate
                                      mode                            :
                                      Variable<br>
                                      Bit
                                      rate                                
                                      : 46.1 Mb/s<br>
Width                                    : 720 pixels<br>
Height                                   : 576 pixels<br>
                                      Display aspect
                                      ratio                     : 5:4<br>
                                      Frame rate
                                      mode                          :
                                      Constant<br>
                                      Frame
                                      rate                              
                                      : 50.000 FPS<br>
                                      Color
                                      space                             
                                      : YUV<br>
                                      Chroma
                                      subsampling                      
                                      : 4:2:2<br>
                                      Bit
                                      depth                               
                                      : 8 bits<br>
                                      Scan
                                      type                               
                                      : Progressive<br>
                                      Compression
                                      mode                         :
                                      Lossless<br>
Bits/(Pixel*Frame)                       : 2.225<br>
                                      Stream
                                      size                             
                                      : 55.0 MiB (95%)<br>
                                      Writing
                                      library                          :
                                      Lavc61.19.101 ffv1<br>
Default                                  : No<br>
Forced                                   : No<br>
                                      Color
                                      range                             
                                      : Limited<br>
coder_type                               : Golomb Rice<br>
ErrorDetectionType                       : Per slice<br>
                                      <br>
                                      Audio<br>
ID                                       : 2<br>
Format                                   : PCM<br>
                                      Format
                                      settings                         
                                      : Little / Signed<br>
                                      Codec
                                      ID                                
                                      : A_PCM/INT/LIT<br>
Duration                                 : 10 s 0 ms<br>
                                      Bit rate
                                      mode                            :
                                      Constant<br>
                                      Bit
                                      rate                                
                                      : 1 536 kb/s<br>
Channel(s)                               : 2 channels<br>
                                      Sampling
                                      rate                            :
                                      48.0 kHz<br>
                                      Bit
                                      depth                               
                                      : 16 bits<br>
                                      Stream
                                      size                             
                                      : 1.83 MiB (3%)<br>
                                      Writing
                                      library                          :
                                      Lavc61.19.101 pcm_s16le<br>
Default                                  : No<br>
Forced                                   : No<br>
                                    </blockquote>
                                    ---------------------------------<br>
                                    <br>
                                    As seen above the "default" Chroma
                                    subsampling  is yuv422p or 4:2:2
                                    with Bit depth: 8 bits<br>
                                    <br>
                                    As ffv1 seemingly also does support
                                    yuv422p10le ffmpeg, I wonder if
                                    yuv422p is limited by the input from
                                    HDMI capture/AV converter?<br>
                                    Can possibly yuv422p10le possibly be
                                    achieved by adding -pix_fmt 10 og
                                    similar syntax to the ffmpeg line?<br>
                                  </div>
                                </blockquote>
                              </div>
                            </div>
                            <div dir="auto"><br>
                            </div>
                            <div dir="auto">you can try  different
                              -input_format, but I suspect 10bit video
                              over v4l2 at best uncommon ... While hdmi
                              itself supports 10bit digital signal, I
                              suspect  non-pro capture devices usually
                              limited to 8bit?</div>
                          </div>
                        </blockquote>
                      </div>
                    </div>
                  </div>
                </blockquote>
                <br>
                <blockquote type="cite">
                  <div dir="auto">
                    <div dir="auto"><a href="https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/HEAD:/libavdevice/v4l2-common.c" rel="noreferrer noreferrer" target="_blank">https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/HEAD:/libavdevice/v4l2-common.c</a></div>
                    <div dir="auto"><br>
                    </div>
                    <div dir="auto">I can't see 10bit yuy2 format listed
                      here, so probably even if hw/driver support it
                      ffmpeg will not ...</div>
                  </div>
                </blockquote>
                <br>
                Yes, It seems this also is the case. <br>
                Even I got a few 10-bits "-input_format" y210 and p210
                accepted by ffmpeg, in both cases the output format
                "defaulted" to the same 'yuv422p'.<br>
                What also surprised me, the filesizes at the same time
                also was reduced to 77%<br>
                <br>
                du -sh *<br>
                45M    720x576_50fps_p210+alsa_ms2130_ffv1-3+pcm.mkv<br>
                45M    720x576_50fps_y210+alsa_ms2130_ffv1-3+pcm.mkv<br>
                58M    720x576_50fps_yuyv422+alsa_ms2130_ffv1-3+pcm.mkv<br>
              </div>
            </blockquote>
          </div>
        </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">I guess they 10 bit but 4:2:0 subsampling?</div>
      </div>
    </blockquote>
    <br>
    Noop, according to mediainfo all have <br>
    <br>
    <font face="Courier New, Courier, monospace">Color
      space                              : YUV<br>
      Chroma subsampling                       : 4:2:2<br>
      Bit depth                                : 8 bits<br></font></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">But this is *after* they left ffmpeg ;)</div><div dir="auto"><br></div><div dir="auto">All those auto-inserting filters may cut input stream according to that user specified, and then expand it back, but with less info, so lossless file will be smaller ....</div><div dir="auto"><br></div><div dir="auto">just idea, not proven.</div><div dir="auto"><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><font face="Courier New, Courier, monospace">
      <br>
    </font>By the way, I acknowledge this limit at the hand.<br>
    10-Bit Video is recommended for Analog Tape Transfer due to color
    shades and branding<br>
    <a href="https://www.archivalworks.com/blog/10-bit-video-transfer" target="_blank" rel="noreferrer">https://www.archivalworks.com/blog/10-bit-video-transfer</a><br>
    <br>
    But I expect also 8-bit 422 transfer to FFV1 opt for some better
    quality than the current 8-bit 420 DV25 files (converted from PAL
    S-video) and the HDV.m2t backup files. <br>
    IMO direct playback of S-vdeo tapes has visual better brightness
    than the converted DV files. <br>
    It remains also to verify if playing 1080i50 HDV tapes via HDMI will
    be up-scaled to 422 and 720p, according to Steve Mullen' FX7
    handbook. <br>
    <br>
    To continue I copy with from my old, initial post at<br>
<a href="https://www.mail-archive.com/cin@lists.cinelerra-gg.org/msg05547.html" target="_blank" rel="noreferrer">https://www.mail-archive.com/cin@lists.cinelerra-gg.org/msg05547.html</a><br>
    <br>
    <br>
    Does all FFV1 level 3 versions work with lossless compression for
    422 video?<br>
    <br>
    I have not yet found a definitiv ffmpeg FFV1 v 3 syntax guide for SD
    and HDV capturing and hope for suggestions and comments regarding
    the examples below:<br>
    <pre style="margin:0em"><font face="Courier New, Courier, monospace">3.1 FFmpeg recipe (PAL)

   ffmpeg -i VIDEO_IN \

       -c:v ffv1 -level 3 -coder 1 -context 0 -slices 24 -slicecrc 1 \
       -color_primaries bt470bg \
       -color_trc bt709 \
       -colorspace bt470bg \
       -color_range mpeg \
       -map 0 \
       -top 1 \
       -c:a copy \
       -g 1 -pix_fmt + \
       VIDEO_OUT.mkv


3.2 Reference Example
<a href="https://trac.ffmpeg.org/wiki/Encode/FFV1#Examples" target="_blank" rel="noreferrer">https://trac.ffmpeg.org/wiki/Encode/FFV1#Examples</a>

    Copy audio "as-is" and use FFV1.3 as video codec.

</font></pre>
        Parameters are 8 threads, coder=1, context=1, GOP-size=1, 24
    slices and slice-CRC on:<font face="Courier New, Courier, monospace"><tt><br>
        <br>
      </tt></font>
    <pre style="margin:0em"><font face="Courier New, Courier, monospace">    ffmpeg -i <input_video>     \
        -acodec   copy          \
        -vcodec   ffv1 -level 3 \
        -threads  8             \
        -coder    1             \
        -context  1             \
        -g        1             \
        -slices  24             \
        -slicecrc 1             \
        <output_video>


3.3 Various Encoding examples for Video capture from USB camera /dev/video0:

</font></pre>
    <font face="Courier New, Courier, monospace">ffmpeg -f v4l2
      -framerate 25 -video_size 720x576 -i /dev/video0 output_data.mkv
      ffmpeg -f v4l2 -framerate 25 -video_size 720x576 -i /dev/video0
      -codec:v ffv1 -codec:a pcm_s16le \
      <br>
          -f matroska  output_video.mkv
    </font><br>
    <font face="Courier New, Courier, monospace">
      <br>
      <br>
      Check that video is captured properly using ffplay:
      <br>
      <br>
      ffmpeg -ar 44100 -thread_queue_size 1024 -f alsa -i $AUDIO \
          -r 25 -thread_queue_size 1024 -i $VIDEO \
          -codec copy -f matroska  - | ffplay <br>
      <br>
    </font><br>
    -
    Check the overall flow using ffplay before capturing:
    <br>
    <font face="Courier New, Courier, monospace"><br>
      ffmpeg -ar 44100 -thread_queue_size 1024 -f alsa -i $AUDIO \
          -itsoffset -0.5 -r 25 -thread_queue_size 1024 -i $VIDEO \
      <br>
          -filter_complex 'channelmap=FL-0' -filter_complex
      'crop=w=700:h=556:x=8:y=0' \
      <br>
          -map 1:v  -map 0:a -codec:v ffv1 -codec:a pcm_s16le \
          -f matroska  - | ffplay -</font><br>
    <br>
    <font face="Courier New, Courier, monospace"><br>
      <br>
    </font><br>
    <blockquote type="cite">
      <div dir="auto">
        <div dir="auto">why we can't have both ;) I mean, it all depend
          on hw, and now board wired ... If there was relatively popular
          capture board I am sure someone tried to push core linux
          kernel bits upstream ...</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">but hw design is harder than it looks.</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">
          <div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div> <br>
                <br>
                <blockquote type="cite">
                  <div dir="auto">
                    <div dir="auto"><br>
                    </div>
                    <div dir="auto">
                      <div class="gmail_quote">
                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                          <div dir="auto">
                            <div dir="auto"><br>
                            </div>
                            <div dir="auto">But of course you better to
                              doublecheck what v4l2 tools says ...</div>
                          </div>
                        </blockquote>
                      </div>
                    </div>
                  </div>
                </blockquote>
                <br>
                So far no other  pixel formats found:<br>
                <br>
                v4l2-ctl -V <br>
                Format Video Capture:<br>
                    Width/Height      : 720/576<br>
                    Pixel Format      : 'YUYV' (YUYV 4:2:2)<br>
                    Field             : None<br>
                    Bytes per Line    : 1440<br>
                    Size Image        : 829440<br>
                    Colorspace        : sRGB<br>
                    Transfer Function : Rec. 709<br>
                    YCbCr/HSV Encoding: ITU-R 601<br>
                    Quantization      : Default (maps to Limited Range)<br>
                    Flags             : <br>
                <br>
                <br>
                <br>
                <blockquote type="cite">
                  <div dir="auto">
                    <div dir="auto">
                      <div class="gmail_quote">
                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                          <div dir="auto">
                            <div dir="auto"><br>
                            </div>
                            <div dir="auto">Sorry for "too generic"
                              answer, few years ago I/we looked into
                              "direct RF capture" and there getting
                              10bit signal was possible, with custom
                              hardware, slow offline processing and
                              invasive hoockup to VCR's internals.</div>
                          </div>
                        </blockquote>
                      </div>
                    </div>
                  </div>
                </blockquote>
                <br>
                Similar I bought and captured a few ProRes422 HQ few
                files in 2016 with Blackmagic Design's HyperDeck
                Shuttle+AD miniconverter+SSD recorder.<br>
                But some years later, BMD's fw support became EOL, and
                the devices became non-working :(<br>
                 <br>
                <blockquote type="cite">
                  <div dir="auto">
                    <div dir="auto">
                      <div class="gmail_quote">
                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                          <div dir="auto">
                            <div dir="auto"><br>
                            </div>
                            <div dir="auto">
                              <div class="gmail_quote">
                                <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                  <div> <br>
                                    <br>
                                    <br>
                                    <br>
                                    <br>
                                    <br>
                                    <br>
                                    <br>
                                    <br>
                                  </div>
                                  -- <br>
                                  Cin mailing list<br>
                                  <a href="mailto:Cin@lists.cinelerra-gg.org" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">Cin@lists.cinelerra-gg.org</a><br>
                                  <a href="https://lists.cinelerra-gg.org/mailman/listinfo/cin" rel="noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank">https://lists.cinelerra-gg.org/mailman/listinfo/cin</a><br>
                                </blockquote>
                              </div>
                            </div>
                          </div>
                        </blockquote>
                      </div>
                    </div>
                  </div>
                </blockquote>
                <br>
              </div>
            </blockquote>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </div>

</blockquote></div></div></div>