Den 02.02.2023 01:46, skrev Terje J. Hanssen:
I have no plan to compete with our National Library located locally
here :)
https://www-nrk-no.translate.goog/nordland/her-skal-den-norske-kulturarven-bevares-i-evig-tid-1.16277933?_x_tr_sl=no&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=sc
but I prepare myself to test and use one method left with regards to
"Personal Video Archiving".
Therefore I have ordered two selected, inexpensive devices (the urls
here are just for English language):
1) Capture Card USB HDMI 4K to 1080P USB-C adapter (Speedy USB
3.2/3.1/3.0, 60 Hz and 1080p FHD.)
https://www.turascandinavia.com/en/products/computer/microphone-webcam/webcams/74257
* Fluid video recordings without delays or distortions during live
streaming
* Linux not mentioned, but assumed this is a standard supported UVC.
OBS and VLC is mentioned.
2) Scart AV SV to HDMI Converter Switcher S Video Composite RCA DVD HD
TV adapter (3-4 weeks delivery time
https://www.ebay.com.au/itm/295472602625
* The 3-in-1 S-/video/RCA/SCART to HDMI converter is a universal
converter for analog video input to HDMI output.
* Analog to digital converter (ADC), 10 bits maximum 1,62 MSPS
sampling,
Q I have not yet found a definitiv ffmpeg FFV1 v 3 syntax guide for SD
and HDV capturing and hope for suggestions and comments here!?
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
https://trac.ffmpeg.org/wiki/Encode/FFV1
Copy audio "as-is" and use FFV1.3 as video codec.
Parameters are 8 threads, coder=1, context=1, GOP-size=1, 24
slices and slice-CRC on:
ffmpeg -i <input_video> \
-acodec copy \
-vcodec ffv1 -level 3 \
-threads 8 \
-coder 1 \
-context 1 \
-g 1 \
-slices 24 \
-slicecrc 1 \
<output_video>
While awaiting the HDMI-USB3 capture dongle next week, I have tested to
transcode a couple of video files to FFV1/MKV. In lack of available
uncompressed 10-bit 422 video files (like v210), I have used two
previous encoded 10-bit ProRes-422HQ (denoted visually or near lossless
compression) as input files, to see what happens.
Input files:
------------
du -sh *.mov
40G Hi8_tape_1_1992+1993.mov # converted to SD from PAL
analog Hi8/S-Video, Sony CCD-TR2000E
1,7G hd01.mov # a short FHD clip from Sony FX7E
camcorder directly via EIP & HDMI
# The Imaging Processor
works at 1920x1080 in a 4:2:2 colorspace.
ffmpeg -i Hi8_tape_1_1992+1993.mov 2>&1 >/dev/null | egrep
"Video|Audio|Duration"
Duration: 01:11:25.28, start: 0.000000, bitrate: 79566 kb/s
Stream #0:0(eng): Video: prores (HQ) (apch / 0x68637061),
yuv422p10le(tv, bt709/unknown/unknown, top coded first (swapped)),
720x576, 61100 kb/s, SAR 59:54 DAR 295:216, 25 fps, 25 tbr, 2500 tbn,
2500 tbc (default)
handler_name : Apple Video Media Handler
Stream #0:1(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz,
hexadecagonal, s32 (24 bit), 18432 kb/s (default)
ffmpeg -i hd01.mov 2>&1 >/dev/null | egrep "Video|Audio|Duration"
Duration: 00:01:11.24, start: 0.000000, bitrate: 200607 kb/s
Stream #0:0(eng): Video: prores (HQ) (apch / 0x68637061),
yuv422p10le(tv, bt709/unknown/unknown, top coded first (swapped)),
1920x1080, 182130 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 2500 tbn, 2500
tbc (default)
handler_name : Apple Video Media Handler
Stream #0:1(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz,
hexadecagonal, s32 (24 bit), 18432 kb/s (default)
Transcoding to FFV1/MKV:
------------------------
ffmpeg -i Hi8_tape_1_1992+1993.mov -acodec copy -vcodec ffv1 -level 3
-threads 8 -coder 1 -context 1 -g 1 -slices 24 -slicecrc 1
Hi8_tape_1_1992+1993_ffv1.mkv
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 7 (SUSE Linux)
...................
[prores @ 0x5613af6cef40] error, wrong slice data size26.64
bitrate=131749.8kbits/s speed=3.88x
[prores @ 0x5613af6cef40] error decoding picture header
Error while decoding stream #0:0: Invalid data found when processing input
frame=107131 fps= 95 q=-0.0 Lsize=70256226kB time=01:11:25.27
bitrate=134306.1kbits/s speed=3.82x
video:60607655kB audio:9641880kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.009525%
# 18.5 minutes on a fast internal SSD nvme0n1 Samsung model: MZVPV512HDG
# (26 minutes on a USB3 Expansion HDD Seagate, %CPU (top): 610-280,
FFMpeg speed: 3.92x-2.68x)
ffmpeg -i hd01.mov -acodec copy -vcodec ffv1 -level 3 -threads 8 -coder
1 -context 1 -g 1 -slices 24 -slicecrc 1 hd01_ffv1.mkv
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 7 (SUSE Linux)
..............
frame= 1781 fps= 23 q=-0.0 Lsize= 4495998kB time=00:01:11.27
bitrate=516733.5kbits/s speed=0.929x
video:4335507kB audio:160380kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.002472%
# ca. 2 minutes on a fast internal SSD nvme0n1 Samsung model:
MZVPV512HDG
Output files:
-------------
du -sh *.mkv
4,3G hd01_ffv1.mkv
68G Hi8_tape_1_1992+1993_ffv1.mkv
ffmpeg -i Hi8_tape_1_1992+1993_ffv1.mkv 2>&1 >/dev/null | egrep
"Video|Audio|Duration"
Duration: 01:11:25.28, start: 0.000000, bitrate: 134306 kb/s
Stream #0:0(eng): Video: ffv1 (FFV1 / 0x31564646), yuv422p10le(tv,
bt709/unknown/unknown, top coded first (swapped)), 720x576, SAR 59:54
DAR 295:216, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
HANDLER_NAME : Apple Video Media Handler
Stream #0:1(eng): Audio: pcm_s24le, 48000 Hz, hexadecagonal, s32 (24
bit), 18432 kb/s (default)
ffmpeg -i hd01_ffv1.mkv 2>&1 >/dev/null | egrep "Video|Audio|Duration"
Duration: 00:01:11.28, start: 0.000000, bitrate: 516719 kb/s
Stream #0:0(eng): Video: ffv1 (FFV1 / 0x31564646), yuv422p10le(tv,
bt709/unknown/unknown, top coded first (swapped)), 1920x1080, SAR 1:1
DAR 16:9, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
HANDLER_NAME : Apple Video Media Handler
Stream #0:1(eng): Audio: pcm_s24le, 48000 Hz, hexadecagonal, s32 (24
bit), 18432 kb/s (default)
Summary and comments:
---------------------
As seen above the SD (Hi8) output FFV1.MKV file has grown with 78/ 40 =
1.7 compared with the input ProRes.mov file,
while the HD output file has grown with 4.3/ 1.7 = 2.5 compared with
the input ProRes.mov clip.
Possibly not as expected, but decoding the compressed ProRes first might
not be optimum. At least I hope that encoding both from a common,
lossless codec like v210 or more actual from an input video stream,
would have shown another, closer picture?
3.3 Various Encoding examples for Video capture from USB camera
/dev/video0:
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 \
-f matroska output_video.mkv
Check that video is captured properly using ffplay:
ffmpeg -ar 44100 -thread_queue_size 1024 -f alsa -i $AUDIO \
-r 25 -thread_queue_size 1024 -i $VIDEO \
-codec copy -f matroska - | ffplay -
Check the overall flow using ffplay before capturing:
ffmpeg -ar 44100 -thread_queue_size 1024 -f alsa -i $AUDIO \
-itsoffset -0.5 -r 25 -thread_queue_size 1024 -i $VIDEO \
-filter_complex 'channelmap=FL-0' -filter_complex
'crop=w=700:h=556:x=8:y=0' \
-map 1:v -map 0:a -codec:v ffv1 -codec:a pcm_s16le \
-f matroska - | ffplay -
4, Regarding FFV1 lossless compression in realtime
Comparison tests (2013/2015) have shown that FFV1 produced the
smallest files at the fastest speed. It can be used to capture SD
material in realtime, and HD possibly, too. This according to a
2012/2015 article, where I have extracted the results for FFV1 v.3 in
the tables below:
http://www.av-rd.com/knowhow/video/comparison_video_codecs_containers.html#codec_tests
NOTE: This is a consumer grade, off-the-shelf PC setup.
Hardware:
CPU: Intel(R) QuadCore(TM) i7-2600K CPU @ 3.40GHz
RAM: 8 GB
Disk: Intel SSDSA2CW080G3 (SSD)
Software:
Operating System: GNU/Linux (Xubuntu 12.04.1, 64bit)
Transcoding tool: FFmpeg (version git N-59183-g3e62654, Dec 17 2013)
Video source file: VQEG reference video "football"
<http://media.xiph.org/video/derf/y4m/football_422_ntsc.y4m> (NTSC-SD,
720x486px, 30fps, yuv422p, 8bpc)
Codec Encoding Decoding Filesize % of uncompressed Implementation
Details
FFV1
<http://www.av-rd.com/knowhow/video/comparison_video_codecs_containers.html#codec_ffv1>
(version 3) 216 fps 277 fps 111 MiB 46.1% libavcodec (FFmpeg)
<http://en.wikipedia.org/wiki/Libavcodec> log
<http://www.av-rd.com/knowhow/video/test_results/football-720x486i30/ffv1.3-libavcodec_ffmpeg_avi.log>,
framemd5
<http://www.av-rd.com/knowhow/video/test_results/football-720x486i30/ffv1.3-libavcodec_ffmpeg_avi.framemd5>
Video source file: SVT reference video "park joy"
<http://media.xiph.org/video/derf/y4m/park_joy_1080p50.y4m>
(full-HD/1080p, 1920x1080px, 50fps, yuv420p, 8bpc)
Codec Encoding Decoding Filesize % of uncompressed Implementation
Details
FFV1
<http://www.av-rd.com/knowhow/video/comparison_video_codecs_containers.html#codec_ffv1>
(version 3) 31 fps 63 fps 879 MiB 57.2% libavcodec (FFmpeg)
<http://en.wikipedia.org/wiki/Libavcodec> log
<http://www.av-rd.com/knowhow/video/test_results/park_joy-1920x1080p50/ffv1.3-libavcodec_ffmpeg_avi.log>,
framemd5
<http://www.av-rd.com/knowhow/video/test_results/park_joy-1920x1080p50/ffv1.3-libavcodec_ffmpeg_avi.framemd5>
PAL-SD 720x576 stored as YUV422, 10 bpc (bits per component), instead
of the tested 8 bpc above, seems to me would have enlarged the the
filesizes with about 25%, or to about 40 GB/hr with FFV1 lossless
compressed.
Although the FFV1 compression results above obviously used yuv422p,
8bps source SD and FHD files as input, it seems for me that the
encoding speeds at 216 fps and 31 fps for SD and FHD respectively,
assumingly should manage realtime FFV1 encoding and streaming of PAL
SD and HDV at 25 fps as well, especially with a faster i7-6700 x 8
cpu. Comments here?
5. Related 2021-[Cin] threads as background references
[Cin] hdmi capture card (with v4l2)
https://www.mail-archive.com/[email protected]/msg02865.html
[Cin] offtopic: Digitize and record Video with A/D USB adapters
https://www.mail-archive.com/[email protected]/msg03269.html
[Cin] offtopic: HDMI capture
https://www.mail-archive.com/[email protected]/msg02084.html
[Cin] Is SD and HD 422 Video Capture obtainable with V4L(2)?
https://www.mail-archive.com/[email protected]/msg03719.html
[Cin] Uncompressed video to lossless compression FFV1/MKV
https://www.mail-archive.com/[email protected]/msg03791.html
--
Cin mailing list
[email protected]
https://lists.cinelerra-gg.org/mailman/listinfo/cin