[Cin] our ffv1.mkv profile

Andrew Randrianasulu randrianasulu at gmail.com
Tue Dec 28 05:42:34 CET 2021


On Monday, December 27, 2021, Terje J. Hanssen <terjejhanssen at gmail.com>
wrote:

>
>
> Den 26.12.2021 23:44, skrev Andrew Randrianasulu:
>
>>
>>
>> On Monday, December 27, 2021, Terje J. Hanssen via Cin <
>> cin at lists.cinelerra-gg.org> wrote:
>>
>>
>>
>>     Den 26.12.2021 21:13, skrev Andrew Randrianasulu via Cin:
>>
>>>
>>>
>>>     On Sunday, December 26, 2021, Phyllis Smith via Cin
>>>     <cin at lists.cinelerra-gg.org> wrote:
>>>
>>>             for now it seems only ffv1.avi defaults to v.0 and mkv
>>>             defaults to 3.4
>>>
>>>         For now, how about if I just add a comment to ffv1.mkv about
>>>         level numbers?   That way the user will see this if they look
>>>         and can decide for themselves.  Otherwise if we make every
>>>         possible setting available we will end up with millions of
>>>         choices and then if we have new ones labeled _3, when level 4
>>>         comes along we would need even more as _4.
>>>
>>>
>>>     ok, add comment please}
>>>
>>>
>>     Ok, maybe I'm thinking aload quite "outside the box" here with my
>>     questions * below:
>>
>>     I seems for me Cin-GG supports ffv1.mkv in two instances (did't
>>     find other mentioned in the manual either):
>>
>>         1) File > Save as: ffv1.mkv (that is save current edited video
>>     from Cin-GG)
>>
>>             and
>>
>>         2) File > Record
>>             using Video compression according to
>>
>>             Settings > Preferences > Record
>>                 File format: FFMPEG mkv
>>                 Video wrench: Compression: ffv1.mkv or user_ffv1.mkv
>>
>>         * Could i.e the empty <Format box> here be used to input
>>     levels and/or other user options?
>>
>>         Further down on this window
>>
>>             Video IN
>>                 Record driver: i.e Video4Linux
>>
>>         * Or possibly get BM Intensity/declink SDK card
>>     working/integrated with ffmpeg/Cin-GG?
>>
>>
>> if you find programmer familiar with both ends.. Cin-gg uses her own code
>> for dealing with v4l2, not ffmpeg's.
>>
>>
> So Cin-gg doesn't use ffmpeg to capture/record video directly from a
> video/TV capture card?


she uses ffmpeg for compression/muxing (and some effects), but not for
interfacing with device...

>
> But I'm not sure I really understand where Record/prefs/preset ffv1.mkv (2
> above) get into this picture?
> Just to record (encode and save) the pre-captured video in a lossless
> ffv1.mkv file format?


no, you are right - this option selects capture codec

>
> What would possible benefits be if ffmpeg had been used to capture/record
> video via the capture card?
> Or do we miss something without ffmpeg doing this?


we miss declink support )

>
>
> In the case of BM Decklink or Intensity Pro 4k, Media Express is available
> (deb, rpm on Linux) for free capture and playback uncompressed 8 or 10-bit
> video or compressed ProRes.


I also noticed there is no way to capture 10 bit rgb/yuv via v4l2.. (
(simply no define for such formats)

https://github.com/torvalds/linux/blob/master/include/uapi/linux/videodev2.h



> A forum user had found out that Quicktime uncompressed 10 bit 4:2:2 .MOV
> was the same codec as AJA v210 for 10-bit uncompressed, i.e. it did not
> require rendering when placed into the FCP timeline. Bit rates examples:
>
> 625 PAL uncompressed 10 bit @ 720 x 576 @ 25fps = 26 MB per/sec, or 93 GB
> per/hr.
> 720p HDTV uncompressed 10 bit @ 1280 x 720 @ 59.94 = 140 MB per/sec, or
> 494 GB per/hr.
> 1080i and 1080p HDTV uncompressed:
> 10 bit @ 1920 x 1080 @ 25fps = 132 MB per/sec, or 463 GB per/hr.


yeah, and if you want more than 1 stream multiply this by num. of streams..


>
> https://gist.github.com/afriza/879fed4ede539a5a6501e0f046f71463
>>
>> (sdk 12 should be compatible with ffmpeg 4.4?)
>>
>> note --extra-cflags="-I$HOME/ffmpeg_build/include
>> -I$HOME/ffmpeg_sources/BMD_SDK/include -I/usr/lib/cuda/include" \
>>
>>   and
>>
>> --enable-nonfree \
>>   --enable-decklink \
>>
>> addditional confugure switches for ffmpeg (you can drop cuda includes if
>> you do not have proprietary nvidia driver/card installed, if course)
>>
>> ---
>> List devices:
>>
>> ffmpeg -f decklink -list_devices 1 -i dummy
>>
>> List supported formats:
>>
>> ffmpeg -f decklink -list_formats 1 -i 'DeckLink Quad HDMI Recorder (1)'
>>
>> Capture Camera at 23.976fps to h264:
>>
>> ffmpeg -y -thread_queue_size 90 -hwaccel cuda \
>> -channels 2 -raw_format yuv422p10 -format_code 23ps -f decklink -i
>> 'DeckLink Quad HDMI Recorder (1)' \
>> -c:a pcm_s16le -c:v libx264 -preset ultrafast -crf 10 ~/camera264.mov
>>
>> ---
>>
>> obviously you can try to just copy frames into mov for 'as uncompressed
>> as possible' and hope your disk(s) will keep up! (I've heard stories some
>> ssd dislike being full - their write speed drop down dramatically.. so try
>> to write to not very full ssd. Not sure abount newer nvme.. or raids from
>> them!)
>>
>> from
>>
>> https://github.com/wonderunit/storyboarder/wiki/Recording-Li
>> ve-Camera-and-Desktop-on-Linux-using-Blackmagic-Decklink
>>
>>
>>
>>
>>         * Get the option to preserve/archive transcoded ffv1.mkv
>>     directly to a storage device?
>>
>>
>> probably not? (no support for arbitrary compressed frames and their
>> metadata in internal representation.. not impossible, but no one did it yet)
>>
>>
>>
>>         * And/or get the option to load /pipe (uncompressed) video
>>     files recorded on one storage (SSD) device,
>>           compress it with the right preset ffv1.mkv and save it to
>>     another storage device.
>>
>>
>> should be default mode of operation for files (not sure about purely raw
>> video w/o any container, apart from dvvideo, but some types of raw rgb/yuv
>> in avi/mov should work.. test a bit?) , for piping...
>>
>> try video loopback?
>>
>> https://github.com/umlaeute/v4l2loopback
>>
>> it may even work for declink input, if your ffmpeg can input frames from
>> declink and output to v4l2..
>>
>>
>> https://superuser.com/questions/1330959/what-is-the-right-ff
>> mpeg-output-format-for-a-v4l2-loopback-device
>>
>> some variation of
>>
>>  ffmpeg examples
>> Grab desktop:
>>
>> ffmpeg -f x11grab -framerate 25 -video_size 1280x720 -i :0.0+0,0 -f v4l2
>> /dev/video0
>> Send file:
>>
>> ffmpeg -re -i input.mp4 -f v4l2 /dev/video0
>>
>> or (in answers)
>>
>> ffmpeg -f x11grab -r 60 -s 1920x1080 -i :0.0+0,0 -vcodec rawvideo
>> -pix_fmt yuv420p -f v4l2 /dev/video0
>>
>> guess you can try variation of such cmdline  with declink input after
>> compiling non-free ffmpeg with Blackmagick sdk...
>>
>> we also probably can use such line for testing non-trivial v4l2 formats
>> in Cinelerra-gg ..
>>
>>
>>>
>>>         On Sat, Dec 25, 2021 at 9:29 PM Andrew Randrianasulu via Cin
>>>         <cin at lists.cinelerra-gg.org> wrote:
>>>
>>>
>>>
>>>             On Sunday, December 26, 2021, Terje J. Hanssen via Cin
>>>             <cin at lists.cinelerra-gg.org> wrote:
>>>
>>>
>>>
>>>                 Den 25.12.2021 17:35, skrev Andrew Randrianasulu via Cin:
>>>
>>>                     seems to miss level=3 setting
>>>
>>>                     $ cat bin/ffmpeg/video/ffv1.avi
>>>                     avi ffv1
>>>                     $ cat bin/ffmpeg/video/ffv1.mkv
>>>                     matroska ffv1
>>>                     threads=8
>>>                     context=1
>>>                     slices=30
>>>                     $ cat bin/ffmpeg/video/ffv1.mov
>>>                     mov ffv1
>>>                     #coder=0
>>>                     context=1
>>>                     g=1
>>>                     level=3
>>>                     threads=16
>>>                     slices=16
>>>                     slicecrc=1
>>>                     #pass=2
>>>                     $
>>>
>>>                     not sure if we should modify our avi/mkv profikes
>>>                     or add new (may be with _v3 name) ones?
>>>
>>>
>>>                 Without own experience yet, I would ask if there any
>>>                 reason to not use the latest and more feature rich
>>>                 FFV1 level=version 3? Backward compitibility, typical
>>>                 can v. 3 uncompress v. 1 compressed archives?
>>>
>>>             good question... I have older avplay (~2012)  here and
>>>             will test.
>>>
>>>             for now it seems only ffv1.avi defaults to v.0 and mkv
>>>             defaults to 3.4 due to crc protection per slice, i think
>>>             (looked into ffmpeg encoder source)
>>>
>>>             {filenames were just that I had in inputbox, not
>>>             indicative of content}
>>>
>>>
>>>             $ mediainfo ~/h265-p2.avi
>>>             General
>>>             Complete name : /data/data/com.termux/files/home/h265-p2.avi
>>>             Format : AVI
>>>             Format/Info : Audio Video Interleave
>>>             File size : 8.82 MiB
>>>             Duration : 3 s 720 ms
>>>             Overall bit rate mode : Variable
>>>             Overall bit rate : 19.9 Mb/s
>>>             Writing application : Lavf58.76.100
>>>
>>>             Video
>>>             ID : 0
>>>             Format : FFV1
>>>             Format version : Version 0
>>>             Codec ID : FFV1
>>>             Duration : 3 s 720 ms
>>>             Bit rate mode : Variable
>>>             Bit rate : 19.9 Mb/s
>>>             Width : 720 pixels
>>>             Height : 576 pixels
>>>             Display aspect ratio : 5:4
>>>             Frame rate : 25.000 FPS
>>>             Standard : PAL
>>>             Color space : YUV
>>>             Chroma subsampling : 4:2:0
>>>             Bit depth : 8 bits
>>>             Compression mode : Lossless
>>>             Bits/(Pixel*Frame) : 1.916
>>>             Stream size : 8.81 MiB (100%)
>>>             coder_type : Golomb Rice
>>>
>>>
>>>             $ mediainfo ~/h265-p2.mkv
>>>             General
>>>             Unique ID : 3614689160526176147752985704114819283
>>>             (0x2B829EF6988D4EEDCB446A8612210D3)
>>>             Complete name : /data/data/com.termux/files/home/h265-p2.mkv
>>>             Format : Matroska
>>>             Format version : Version 4
>>>             File size : 7.48 MiB
>>>             Duration : 3 s 80 ms
>>>             Overall bit rate mode : Variable
>>>             Overall bit rate : 20.4 Mb/s
>>>             Writing application : Lavf58.76.100
>>>             Writing library : Lavf58.76.100
>>>             ErrorDetectionType : Per level 1
>>>
>>>             Video
>>>             ID : 1
>>>             Format : FFV1
>>>             Format version : Version 3.4
>>>             Codec ID : V_MS/VFW/FOURCC / FFV1
>>>             Duration : 3 s 80 ms
>>>             Bit rate mode : Variable
>>>             Bit rate : 20.0 Mb/s
>>>             Width : 720 pixels
>>>             Height : 576 pixels
>>>             Display aspect ratio : 5:4
>>>             Frame rate mode : Constant
>>>             Frame rate : 25.000 FPS
>>>             Standard : PAL
>>>             Color space : YUV
>>>             Chroma subsampling : 4:2:0
>>>             Bit depth : 8 bits
>>>             Scan type : Progressive
>>>             Compression mode : Lossless
>>>             Bits/(Pixel*Frame) : 1.927
>>>             Stream size : 7.34 MiB (98%)
>>>             Default : Yes
>>>             Forced : No
>>>             Color range : Full
>>>             Matrix coefficients : BT.470 System B/G
>>>             coder_type : Golomb Rice
>>>             MaxSlicesCount : 30
>>>             ErrorDetectionType : Per slice
>>>
>>>
>>>
>>>                 I conclude that a couple of referense papers on the
>>>                 web say and use level 3 in their profile/presets:
>>>
>>>                 1) Video into Matroska/FFV1
>>>                 https://avpres.net/FFmpeg/im_FFV1.html
>>>                 <https://avpres.net/FFmpeg/im_FFV1.html>
>>>
>>>                 We advise to use only the version 3 of FFV1 in
>>>                 production, because the version 1 is deprecated, the
>>>                 version 2 has never really existed, and the version 4
>>>                 is currently under development.
>>>
>>>
>>>                 Transcode a video file using the FFV1 codec into the
>>>                 Matroska container for preservation purposes.
>>>                 Solution
>>>
>>>                     ffmpeg \
>>>                         -i input_file \
>>>                         -c:v ffv1 \
>>>                         -level 3 \
>>>                         -coder 1 \
>>>                         -context 1 \
>>>                         -g 1 \
>>>                         -slices 24 \
>>>                         -slicecrc 1 \
>>>                         -c:a copy \
>>>                         output_file.mkv
>>>
>>>                 2) Presets for FFV1 and MKV: Choosing the right
>>>                 parameters for the job (ffv1_params.pdf)
>>>                 https://docs.google.com/viewer
>>> ?url=https%3A%2F%2Fmediaarea.net%2FEvents%2F2019-12-05_NoTim
>>> eToWait4%2F03.%2520Peter%2520B.%2520-%2520Presets%2520for%
>>> 2520FFV1%2520and%2520MKV%2C%2520Choosing%2520the%
>>> 2520right%2520parameters%2520for%2520the%2520job%
>>> 2Fffv1_params.pdf&pdf=true
>>>                 <https://docs.google.com/viewe
>>> r?url=https%3A%2F%2Fmediaarea.net%2FEvents%2F2019-12-05_NoTi
>>> meToWait4%2F03.%2520Peter%2520B.%2520-%2520Presets%2520for%
>>> 2520FFV1%2520and%2520MKV%2C%2520Choosing%2520the%
>>> 2520right%2520parameters%2520for%2520the%2520job%
>>> 2Fffv1_params.pdf&pdf=true>
>>>
>>>                 Level = FFV1 version
>>>                 page 9 (of 30)
>>>
>>>                     0
>>>                     1 (Default)
>>>                     3 (Recommended)
>>>
>>>
>>>                 FFmpeg recipe (PAL)
>>>                 page 27 (of 30)
>>>
>>>                 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
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>                 --                 Cin mailing list
>>>                 Cin at lists.cinelerra-gg.org
>>>                 https://lists.cinelerra-gg.org/mailman/listinfo/cin
>>>                 <https://lists.cinelerra-gg.org/mailman/listinfo/cin>
>>>
>>>             --             Cin mailing list
>>>             Cin at lists.cinelerra-gg.org
>>>             https://lists.cinelerra-gg.org/mailman/listinfo/cin
>>>             <https://lists.cinelerra-gg.org/mailman/listinfo/cin>
>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20211228/ad3e1c20/attachment-0001.htm>


More information about the Cin mailing list