<br><br>On Sunday, December 19, 2021, Terje J. Hanssen <<a href="mailto:terjejhanssen@gmail.com">terjejhanssen@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
Den 19.12.2021 03:38, skrev Andrew Randrianasulu:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
On Sunday, December 19, 2021, Terje J. Hanssen <<a href="mailto:terjejhanssen@gmail.com" target="_blank">terjejhanssen@gmail.com</a> <mailto:<a href="mailto:terjejhanssen@gmail.com" target="_blank">terjejhanssen@gmail.co<wbr>m</a>>> wrote:<br>
<br>
<br>
<br>
Den 19.12.2021 01:00, skrev Andrew Randrianasulu:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
On Sunday, December 19, 2021, Terje J. Hanssen<br>
<<a href="mailto:terjejhanssen@gmail.com" target="_blank">terjejhanssen@gmail.com</a> <mailto:<a href="mailto:terjejhanssen@gmail.com" target="_blank">terjejhanssen@gmail.co<wbr>m</a>>> wrote:<br>
<br>
<br>
[.......]<br>
<br>
</blockquote></blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
===============<br>
<br>
I-frame-only 50 Megabit MPEG-2 or<br>
comparable<br>
DV50 in<br>
4:2:2 as<br>
high-end, "visually lossless"<br>
intermediate<br>
format for<br>
archival and<br>
suited for editing?<br>
<br>
-----------------<br>
<br>
Regarding DV50, FFMpeg has a<br>
friendly "target<br>
dv50"<br>
support<br>
(similar as "target DVD"). So to<br>
get a first<br>
look on a<br>
DV50 test<br>
file, I simply transcoded<br>
422/10bit Video and PCM<br>
audio from a MOV<br>
file (ProRes 422HQ) to a raw DV50<br>
(422/8bit) file:<br>
<br>
ffmpeg -i SD-MOV.mov -target<br>
pal-dv50<br>
SD-DV50.dv<br>
<br>
[......]<br>
<br>
<br>
205M SD-DV50.dv (ffmpeg<br>
re-encoded/remuxed)<br>
AV-info:<br>
<br>
avprobe SD-DV50.dv<br>
avprobe version 12.3, Copyright<br>
(c) 2007-2018 the<br>
Libav developers<br>
built on Mar 26 2018 12:39 with<br>
gcc 11 (SUSE<br>
Linux)<br>
[dv @ 0x55cdddb96440] Estimating<br>
duration from<br>
bitrate, this may<br>
be inaccurate<br>
Input #0, dv, from 'SD-DV50.dv':<br>
Metadata:<br>
timecode : 00:00:00:00<br>
Duration: 00:00:29.80, start:<br>
0.000000, bitrate:<br>
57600 kb/s<br>
Stream #0:0: Video: dvvideo,<br>
yuv422p,<br>
720x576 [SAR<br>
16:15 DAR<br>
4:3], 25000 kb/s, 25 fps, 25 tbr,<br>
25 tbn, 25 tbc<br>
Stream #0:1: Audio: pcm_s16le,<br>
48000 Hz, stereo,<br>
s16, 1536 kb/s<br>
Stream #0:2: Audio: pcm_s16le,<br>
48000 Hz, stereo,<br>
s16, 1536 kb/s<br>
# avprobe output<br>
<br>
===================<br>
<br>
As seen above, it looks like<br>
ffmpeg produced wrong<br>
meta data for<br>
the DV50 video bitrate (25<br>
Mb/s=DV25), while<br>
the total<br>
bitrate<br>
57.6 Mb/s is correct. (Also<br>
similar was seen with<br>
ffprobe and<br>
Mediainfo).<br>
<br>
My VLC player or Gnome<br>
movieplayer did not<br>
playback<br>
the DV50 file,<br>
while ffplay did (as usual<br>
without audio?).<br>
<br>
Cin-GG miss a DV50 preset among<br>
format setting.<br>
However DV50 else<br>
loades preliminary OK in Cin-GG<br>
(via ffmpeg).<br>
<br>
<br>
I'll look at dv50 output preset..<br>
<br>
Fine<br>
<br>
===============<br>
<br>
I tried also to transcode and remux 422 Video<br>
and PCM<br>
Audio to a<br>
50 Mbps MPEG-2 I-frame only program stream.<br>
<br>
1) MPG From MOV (ProRes 422HQ)<br>
------------------------------<br>
<br>
ffmpeg -i SD-MOV.mov -c:v mpeg2video -bf 2<br>
-b:v 50M<br>
-maxrate 50M<br>
-minrate 50M -c:a pcm_s16be -f vob SD-MP2I-50.mpg<br>
[....]<br>
Stream mapping:<br>
Stream #0:0 -> #0:0 (prores (native) -><br>
mpeg2video (native))<br>
Stream #0:1 -> #0:1 (pcm_s24le (native) -><br>
pcm_s16be<br>
(native))<br>
Press [q] to stop, [?] for help<br>
[mpeg2video @ 0x560ffd164ec0] Automatically<br>
choosing VBV<br>
buffer<br>
size of 746 kbyte<br>
[vob @ 0x560ffd14d180] At most 8 channels<br>
allowed for LPCM<br>
streams.<br>
Could not write header for output file #0<br>
(incorrect codec<br>
parameters ?): Invalid argument<br>
Error initializing output stream 0:1 --<br>
<br>
***This failed because PreRes Audio uses 16<br>
channels:***<br>
<br>
<br>
yeah... interesting limitation.. and interesting<br>
number of<br>
channels..<br>
<br>
<br>
ffprobe SD-MOV.mov 2>&1 >/dev/null | grep<br>
Stream.*Audio<br>
Stream #0:1(eng): Audio: pcm_s24le (lpcm /<br>
0x6D63706C),<br>
48000<br>
Hz, 16 channels, s32 (24 bit), 18432 kb/s<br>
(default)<br>
<br>
<br>
2) MPG from DV50<br>
----------------<br>
ffmpeg -i SD-DV50.dv -c:v mpeg2video -bf 2<br>
-b:v 50M<br>
-maxrate 50M<br>
-minrate 50M -c:a pcm_s16be -f vob SD-MP2I-50.mpg<br>
<br>
du -sh *<br>
205M SD-DV50.dv<br>
284M SD-MOV.mov<br>
186M SD-MP2I-50.mpg<br>
<br>
avprobe SD-MP2I-50.mpg<br>
Input #0, mpeg, from 'SD-MP2I-50.mpg':<br>
Duration: 00:00:29.77, start: 0.540000,<br>
bitrate: 52167 kb/s<br>
Stream #0:0[0x1e0]: Video: mpeg2video<br>
(4:2:2), yuv422p(tv,<br>
progressive), 720x576 [SAR 16:15 DAR 4:3],<br>
50000 kb/s, 25<br>
fps, 25<br>
tbr, 90k tbn, 50 tbc<br>
Stream #0:1[0xa0]: Audio: pcm_dvd, 48000<br>
Hz, 2<br>
channels, s16,<br>
1536 kb/s<br>
<br>
***** The SD-MP2I-50.mpg file size is here<br>
90% of DV50<br>
********<br>
<br>
The SD-MP2I-50.mpg playback ok with VLC,<br>
Gnome movieplayer,<br>
ffplay, and loads and playback in Cin-GG<br>
The audio volume seems low (weak), but can<br>
probably be<br>
adjusted<br>
higher with ffmpeg<br>
<br>
<br>
well, but I missed keyframe parameter? bitrate is<br>
big but I<br>
think without special param ffmpeg still will not<br>
make all-I<br>
mpeg2 stream..?<br>
<br>
<br>
<br>
The first Video part of my ffmpeg script was based on<br>
this<br>
standard FFmpeg Howto for<br>
"MPEG-2 I-frame only Highest Quality Encoding", which<br>
didn't<br>
include a keyframe parameter !?<br>
<a href="https://brunosan.eu/images/ffmpeg_howto.html#Encoding_MPEG-2_I-frame_only_in_Highest_Quality" target="_blank">https://brunosan.eu/images/ffm<wbr>peg_howto.html#Encoding_MPEG-<wbr>2_I-frame_only_in_Highest_<wbr>Quality</a><br>
<<a href="https://brunosan.eu/images/ffmpeg_howto.html#Encoding_MPEG-2_I-frame_only_in_Highest_Quality" target="_blank">https://brunosan.eu/images/ff<wbr>mpeg_howto.html#Encoding_MPEG-<wbr>2_I-frame_only_in_Highest_<wbr>Quality</a>><br>
<br>
<<a href="https://brunosan.eu/images/ffmpeg_howto.html#Encoding_MPEG-2_I-frame_only_in_Highest_Quality" target="_blank">https://brunosan.eu/images/ff<wbr>mpeg_howto.html#Encoding_MPEG-<wbr>2_I-frame_only_in_Highest_<wbr>Quality</a><br>
<<a href="https://brunosan.eu/images/ffmpeg_howto.html#Encoding_MPEG-2_I-frame_only_in_Highest_Quality" target="_blank">https://brunosan.eu/images/ff<wbr>mpeg_howto.html#Encoding_MPEG-<wbr>2_I-frame_only_in_Highest_<wbr>Quality</a>>><br>
<br>
ffmpeg -i <input_file> -vcodec mpeg2video -pix_fmt<br>
yuv422p -qscale<br>
1 -qmin 1 -intra -an output.m2v<br>
<br>
<br>
you missed<br>
<br>
-intra?<br>
<br>
<br>
Thanks for reviewing. "-intra" should definitely be there,<br>
and I know I used it before editing and troubleshooting the<br>
audiopart, removing -an. Cleaned up and added also some other<br>
parameters<br>
-q:v 1 -qmin 1 -intra<br>
<br>
<br>
3) MP2I50 from DV50:<br>
---------------------<br>
ffmpeg -i SD-DV50.dv -c:v mpeg2video -q:v 1 -qmin 1 -intra<br>
-bf 2 -b:v 50M -maxrate 50M -minrate 50M -c:a pcm_s16be -f<br>
vob SD-MP2I50.mpg<br>
[...]<br>
Input #0, dv, from 'SD-DV50.dv':<br>
Metadata:<br>
timecode : 00:00:00:00<br>
Duration: 00:00:29.80, start: 0.000000, bitrate: 57600 kb/s<br>
Stream #0:0: Video: dvvideo, yuv422p, 720x576 [SAR 16:15<br>
DAR 4:3], 25000 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc<br>
Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s<br>
Stream #0:2: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s<br>
[... a lot of vob buffer messages scrolling ....]<br>
[vob @ 0x564dbf6a0680] packet too large, ignoring buffer<br>
limits to mux it<br>
[vob @ 0x564dbf6a0680] buffer underflow st=1 bufi=7204 size=7680<br>
frame= 745 fps=460 q=1.0 Lsize= 189584kB time=00:00:29.76<br>
bitrate=52186.6kbits/s speed=18.4x<br>
video:181698kB audio:5588kB subtitle:0kB other streams:0kB<br>
global headers:0kB muxing overhead: 1.227127%<br>
<br>
avprobe SD-MP2I50.mpg<br>
avprobe version 12.3, Copyright (c) 2007-2018 the Libav<br>
developers<br>
built on Mar 26 2018 12:39 with gcc 7 (SUSE Linux)<br>
Input #0, mpeg, from 'SD-MP2I50.mpg':<br>
Duration: 00:00:29.80, start: 0.540000, bitrate: 52116 kb/s<br>
Stream #0:0[0x1e0]: Video: mpeg2video (4:2:2),<br>
yuv422p(tv, progressive), 720x576 [SAR 16:15 DAR 4:3], 50000<br>
kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc<br>
Stream #0:1[0xa0]: Audio: pcm_dvd, 48000 Hz, 2 channels,<br>
s16, 1536 kb/s<br>
<br>
================<br>
<br>
(Re)tested also with<br>
<br>
4) No intra (-intra)<br>
ffmpeg -i SD-DV50.dv -c:v mpeg2video -bf 2 -b:v 50M -maxrate<br>
50M -minrate 50M -c:a pcm_s16be -f vob SD-MP2-50.mpg<br>
<br>
5) Without specified Video bitrate (-b:v)<br>
ffmpeg -i SD-DV50.dv -c:v mpeg2video -q:v 1 -qmin 1 -intra<br>
-bf 2 -c:a pcm_s16be -f vob SD-MP2I-.mpg<br>
<br>
6) Video only - no Audio (-an):<br>
ffmpeg -i SD-DV50.dv -vcodec mpeg2video -q:v 1 -qmin 1 -intra<br>
-an SD-MP2I50-an.m2v<br>
<br>
-----------------<br>
<br>
du -sh *<br>
284M SD-MOV.mov<br>
205M SD-DV50.dv<br>
186M SD-MP2I50.mpg (3)<br>
186M SD-MP2-50.mpg (4)<br>
153M SD-MP2I-.mpg (5)<br>
146M SD-MP2I50-an.m2v (6)<br>
<br>
As seen, no size difference between -intra (3) and without<br>
intra flag specified (4) above:<br>
186/205 = 90% size of the input SD-DV50.dv<br>
<br>
I would expect this due to high bitrate and some more<br>
effectiv video compression for MPEG-2 over DV50.<br>
While the consumer DV25/4:2:0 pal uses 5:1 intra compression,<br>
the pro(sumer) DV50/4:2:2 uses lower 3.3:1.<br>
<br>
-------------<br>
<br>
7) Another, equivalent SD MPEG-2/ 422P@ML option to setup for<br>
Cin-GG/ FFMpeg preset could be:<br>
<br>
D10 aka Sony IMX50 Encoding - a standard definition<br>
professional video recording format. Uses intraframe<br>
compression, 4:2:2 color subsampling and user-selectable<br>
constant video data rate of 30, 40 or 50 Mbit/s.<br>
<br>
422P@ML 720 × 576 25 FPS 4:2:2 Sampling 50 Mbits/s<br>
Sony IMX50 (I only), Broadcast Contribution (I&P only)<br>
<br>
The Howto contains both a short and a long script version.<br>
<br>
----------------<br>
<br>
<br>
ffmpeg changes cmd line and API quickly.. (<br>
<br>
try "-g 1" and check keyframes with some linevlike those?<br>
<br>
<a href="https://snippets.bentasker.co.uk/page-1707191206-Get-Video-Keyframe-Interval-(ffprobe)-BASH.html" target="_blank">https://snippets.bentasker.co.<wbr>uk/page-1707191206-Get-Video-K<wbr>eyframe-Interval-(ffprobe)-BAS<wbr>H.html</a><br>
<<a href="https://snippets.bentasker.co.uk/page-1707191206-Get-Video-Keyframe-Interval-(ffprobe)-BASH.html" target="_blank">https://snippets.bentasker.co<wbr>.uk/page-1707191206-Get-Video-<wbr>Keyframe-Interval-(ffprobe)-<wbr>BASH.html</a>><br>
<<a href="https://snippets.bentasker.co.uk/page-1707191206-Get-Video-Keyframe-Interval-(ffprobe)-BASH.html" target="_blank">https://snippets.bentasker.co<wbr>.uk/page-1707191206-Get-Video-<wbr>Keyframe-Interval-(ffprobe)-<wbr>BASH.html</a><br>
<<a href="https://snippets.bentasker.co.uk/page-1707191206-Get-Video-Keyframe-Interval-(ffprobe)-BASH.html" target="_blank">https://snippets.bentasker.co<wbr>.uk/page-1707191206-Get-Video-<wbr>Keyframe-Interval-(ffprobe)-<wbr>BASH.html</a>>><br>
<br>
<br>
I tried to copy and paste some line from the manual url, but<br>
If you possibly can setup an exact FF syntax to run here, I<br>
can do it ;)<br>
<br>
<br>
attached copy of script Phyllis send to me back in 2019<br>
<br>
</blockquote>
<br>
Sorry I'm not skilled with sed scripts. "Somewhere" I would expect<br>
my encoded file name "SD-MP2I50.mpg" should be put in to be read<br>
and analyzed with ffprobe? And what about the first mentioned "-g 1" ?<br>
<br>
<br>
try to run script like this (after chmod +x on it) :<br>
<br>
<br>
$ ./kfrm.sh vid_20210526.mp4<br>
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'vid_20210526.mp4':<br>
Metadata:<br>
major_brand : isom<br>
minor_version : 512<br>
compatible_brands: isomiso2avc1mp41<br>
encoder : Lavf58.76.100<br>
Duration: 00:00:36.64, start: 0.000000, bitrate: 1314 kb/s<br>
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, unknown/bt470bg/unknown), 640x480 [SAR 27:64 DAR 9:16], 1217 kb/s, 29.58 fps, 29.58 tbr, 11360 tbn, 59.17 tbc (default)<br>
Metadata:<br>
handler_name : VideoHandle<br>
vendor_id : [0][0][0][0]<br>
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 90 kb/s (default)<br>
Metadata:<br>
handler_name : SoundHandle<br>
vendor_id : [0][0][0][0]<br>
key_frame=1<br>
key_frame=0<br>
key_frame=0<br>
<br>
<br>
for all I frames it should output key_frame=1 for all (many!) frames.<br>
<br>
you can add ' | grep 0' at the end of this line and see how many non-keyframes it will find.<br>
<br>
-g is ffmpeg parameter setting distance between keyframes.<br>
<br>
<br>
<br>
What are we really searching for or verify in this I-frame only<br>
encoded MPEG-2 video file ?<br>
<br>
<br>
yes we try to verify it really all-I frames file. (impact seekability among other things)<br>
<br>
<br>
<br>
And isn't keyframes another (previous?) name for Intra-frames?<br>
<br>
<br>
yes, as far as I know.<br>
<br>
<br>
</blockquote>
<br>
Thanks, script testrun executed with attached output here.<br>
Test-run_Intra-frame_key_word<br>
<br>
As seen below from the summary table, all files except the MPEG-2 generated "SD-MP2-50.mpg" without the ffmpeg -intra flag set, contains all Intra-frames only:<br>
<br>
------------------------------<wbr>-------------------------<br>
du -sh SD*.* # key_frame=1 # key_frame=0<br>
(# I-frames) (# non-I-frames)<br>
284M SD-MOV.mov 746 0<br>
205M SD-DV50.dv 745 0<br>
186M SD-MP2I50.mpg 745 0<br>
153M SD-MP2I-.mpg 745 0<br>
186M SD-MP2-50.mpg 63 682<br>
146M SD-MP2I50-an.m2v 745 0</blockquote><div><br></div><div>good! </div><div><br></div><div>but a bit concerned 746 vs 745 frame count. Are we losing one frame somewhere? </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Counts matched # key_frame=1 (I-frames)<br>
./kfrm.sh SD-MOV.mov | grep -c key_frame=1<br>
<br>
Counts other (unmatched) than key_frame=1<br>
./kfrm.sh SD-MOV.mov | grep -v -c key_frame=1<br>
<br>
------------------------------<wbr>--------------------------<br>
<br>
</blockquote>