Page 3 of 3

Re: GOP header timecode

Posted: Wed Nov 03, 2021 11:40 am
by emcodem
I made a really stupid mistake and forgot to insert all the closedGOP stuff in the commands i prepared for you above.
Sorry, sorry sorry! I'll delete the command and workflow in the post above so nobody runs into troubles because of it.

Code: Select all

cmd /C ""%s_ffmpeg%" -nostdin -hide_banner -analyzeduration 33554432 -i "%s_source%"  -shortest -map_metadata -1 -map 0:0 -map 0:1 -map 0:2 -map 0:3 -map 0:4 -map 0:5 -map 0:5 -map 0:7 -map 0:8 -c:a pcm_s24le -vf "il=l=d:c=d,colorspace=fast=1:all=bt709:format=yuv422p:ispace=bt709:itrc=bt709:iprimaries=bt709,il=l=i:c=i,fps=25,setfield=tff,setdar=16/9,setsar=1" -timecode 01:00:00:00 -c:v mpeg2video -r 25 -pix_fmt yuv422p -aspect 16:9 -intra_vlc 1 -b:v 50000000 -minrate 50000000 -maxrate 50000000 -bf 2 -bufsize 17825792 -rc_init_occupancy 17825792 -non_linear_quant 1 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -seq_disp_ext 1 -video_format component -color_range 1 -chroma_sample_location topleft -signal_standard 4 -dc 8 -qmin 5 -qmax 23 -g 12 -field_order tt -top 1 -alternate_scan 1 -intra_matrix 8,10,22,27,29,37,37,40,9,12,14,28,29,37,39,40,9,14,27,31,34,37,40,48,12,22,27,29,34,37,40,58,26,27,29,34,37,38,48,58,26,27,29,36,38,38,48,69,18,27,34,36,38,38,48,69,26,26,34,34,38,40,58,79 -inter_matrix 16,20,22,26,28,32,32,36,18,20,22,28,28,32,34,36,18,22,26,30,30,32,36,38,20,22,26,28,30,32,36,42,24,26,28,30,32,34,38,40,24,26,28,32,34,34,38,42,24,26,30,32,34,34,38,42,24,24,30,30,34,36,40,44 -f mxf -max_muxing_queue_size 700 -map_metadata -1 -metadata "creation_time=now" -b_strategy 0 -sc_threshold 1000000000 -flags +ildct+ilme+cgop -mpv_flags +strict_gop -y - | "%s_ffastrans_dir%\Processors\mxf_tools\bmxtranswrap.exe" -t rdd9 -o "%s_source%_transcoded.mxf" -"
emcodem_closedGOP_xdcamhd_.json
(3.11 KiB) Downloaded 268 times

Re: GOP header timecode

Posted: Fri Nov 05, 2021 2:23 pm
by Ghtais
Hi all,

I have some updates for you guys 8-)
First of all, I want to say again thank you for all the amazing work you have done on this project. you're are more professional than big brands (no name here but we know all of them ;) )
Again many thanks !

During this week, I have done many tests. I have downloaded elecard Streameye (demo version) which is very powerful tool to understand and validate what is going on directly in an Mpeg2 stream.

the goal is to have :
1 : Closed GOP
2 : Time code in each header GOP should be 01:00:00:00

Fisrt : Emcodem FFMpeg :)
Image

-> Ok for closed GOP !
-> Ok for timecode in each header GOP !
You can see the quantization (video quality), I come back later on this part.

Here is the barchart which represent each frame : I (red), P (blue), B(Green). You can see the size of each frame in bits and it depends of the encoder setting, and the encoding engine. You can also see the instant bitrate in blue.
Image
here is the direct link to see more clearly.
https://raw.githubusercontent.com/Fred7 ... 7VRTBQT7JK

So we can say the challenge is completed ! I have to submit the file to my broadcaster to see if it passe BATON QC but I'am confident.

now, I have done same test with MAINCONCEPT and with AVID. Here is the link to sse the result :

MAINCONCEPT : Close GOP ok, Timecode always at 00:00:00:00, I have opened a ticket and it seems that we cannot setting the timecode in totalstudio (they have an other app, Mainconcept2GO which you can do what you want i think)
Result : https://github.com/Fred73-clio/FFAStran ... g?raw=true
Barchart mainconcept : https://github.com/Fred73-clio/FFAStran ... g?raw=true

AVID : Closed GOP only on the fisrt head GOP, after that open GOP, Timecode at 01:00:00:00 for the first header GOP and restart at 00:00:00:00 after that.
Sorry I cannot post the result because this forum doesn't autorise more than 6 URL link

Ok, now what about the video quality ?
Avid is the best with mainconcept. FFmpeg is a little behind but you can see in results posted above that quantization is not the same between AVID, Mainconcept and FFMpeg so I try to set FFMPEG with Qmin:2 and Qmax15 to see what happen

Image
We obtain a quantization average of 3.80 which is pretty close to mainconcept. I can see the difference on the screen (With the fisrt FFmpeg setting) and I think I'am going to keep like this in the future.
The strange thing is, even Qmax was set to 15, we have Qmax = 22 in StreamEye :?:

ok now it's time for noob FFAstrans question ! :geek: :geek:
1 : I would like to copy audio instead of re encode it.
2 : I would like to rewrapp in a second step with the next node in my workflow and I'am struggling to find the correct code.
Any help would be appreciated ;)

Bye

Re: GOP header timecode

Posted: Mon Nov 08, 2021 1:40 pm
by emcodem
OK, i removed the restriction on posting links in the forum, it doesnt really make sense. Also i raised the allowed attachments from 3 to 10.

Thats really good info Ghtais, we are still working on this hehe... just know for now that setting min and qmax too small, depending on the complexity of the input file, you can get an output file with far too much bitrate, e.g. 100Mbit/s. So if you go with such low settings, make sure you do a rough check of the final output filesize vs duration in order to see if the estimated overall bitrate (video+audios+mxf overhead) isn't exceeded a lot.
Again, We still work on that quality topic and get back to you with our results but this is more like a mit-long term thing, no quick result is expected here.

On copying audio, well if the input is pcm_s24le and the output is as well, it is effectively copied. Otherwise, you can specify -c:a copy instead of course. It all depends on the number of track of input and output file. If it shall be the same, you just do -map 0:a -codec copy

On rewrapping in a second step, i am not sure what you are after.
Let's for example start with the same command i posted above:

Code: Select all

cmd /C ""%s_ffmpeg%" -nostdin -hide_banner -analyzeduration 33554432 -i "%s_source%"  -shortest -map_metadata -1 -map 0:0 -map 0:1 -map 0:2 -map 0:3 -map 0:4 -map 0:5 -map 0:5 -map 0:7 -map 0:8 -c:a pcm_s24le -vf "il=l=d:c=d,colorspace=fast=1:all=bt709:format=yuv422p:ispace=bt709:itrc=bt709:iprimaries=bt709,il=l=i:c=i,fps=25,setfield=tff,setdar=16/9,setsar=1" -timecode 01:00:00:00 -c:v mpeg2video -r 25 -pix_fmt yuv422p -aspect 16:9 -intra_vlc 1 -b:v 50000000 -minrate 50000000 -maxrate 50000000 -bf 2 -bufsize 17825792 -rc_init_occupancy 17825792 -non_linear_quant 1 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -seq_disp_ext 1 -video_format component -color_range 1 -chroma_sample_location topleft -signal_standard 4 -dc 8 -qmin 5 -qmax 23 -g 12 -field_order tt -top 1 -alternate_scan 1 -intra_matrix 8,10,22,27,29,37,37,40,9,12,14,28,29,37,39,40,9,14,27,31,34,37,40,48,12,22,27,29,34,37,40,58,26,27,29,34,37,38,48,58,26,27,29,36,38,38,48,69,18,27,34,36,38,38,48,69,26,26,34,34,38,40,58,79 -inter_matrix 16,20,22,26,28,32,32,36,18,20,22,28,28,32,34,36,18,22,26,30,30,32,36,38,20,22,26,28,30,32,36,42,24,26,28,30,32,34,38,40,24,26,28,32,34,34,38,42,24,26,30,32,34,34,38,42,24,24,30,30,34,36,40,44 -f mxf -max_muxing_queue_size 700 -map_metadata -1 -metadata "creation_time=now" -b_strategy 0 -sc_threshold 1000000000 -flags +ildct+ilme+cgop -mpv_flags +strict_gop -y - | "%s_ffastrans_dir%\Processors\mxf_tools\bmxtranswrap.exe" -t rdd9 -o "%s_source%_transcoded.mxf" -"
splitting that into 2 steps, would mean to first transcode and write to file _transcoded.mxf:

Code: Select all

cmd /C ""%s_ffmpeg%" -nostdin -hide_banner -analyzeduration 33554432 -i "%s_source%"  -shortest -map_metadata -1 -map 0:0 -map 0:1 -map 0:2 -map 0:3 -map 0:4 -map 0:5 -map 0:5 -map 0:7 -map 0:8 -c:a pcm_s24le -vf "il=l=d:c=d,colorspace=fast=1:all=bt709:format=yuv422p:ispace=bt709:itrc=bt709:iprimaries=bt709,il=l=i:c=i,fps=25,setfield=tff,setdar=16/9,setsar=1" -timecode 01:00:00:00 -c:v mpeg2video -r 25 -pix_fmt yuv422p -aspect 16:9 -intra_vlc 1 -b:v 50000000 -minrate 50000000 -maxrate 50000000 -bf 2 -bufsize 17825792 -rc_init_occupancy 17825792 -non_linear_quant 1 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -seq_disp_ext 1 -video_format component -color_range 1 -chroma_sample_location topleft -signal_standard 4 -dc 8 -qmin 5 -qmax 23 -g 12 -field_order tt -top 1 -alternate_scan 1 -intra_matrix 8,10,22,27,29,37,37,40,9,12,14,28,29,37,39,40,9,14,27,31,34,37,40,48,12,22,27,29,34,37,40,58,26,27,29,34,37,38,48,58,26,27,29,36,38,38,48,69,18,27,34,36,38,38,48,69,26,26,34,34,38,40,58,79 -inter_matrix 16,20,22,26,28,32,32,36,18,20,22,28,28,32,34,36,18,22,26,30,30,32,36,38,20,22,26,28,30,32,36,42,24,26,28,30,32,34,38,40,24,26,28,32,34,34,38,42,24,26,30,32,34,34,38,42,24,24,30,30,34,36,40,44 -f mxf -max_muxing_queue_size 700 -map_metadata -1 -metadata "creation_time=now" -b_strategy 0 -sc_threshold 1000000000 -flags +ildct+ilme+cgop -mpv_flags +strict_gop -y "%s_source%_transcoded.mxf""
And after that, do the wrapping

Code: Select all

"%s_ffastrans_dir%\Processors\mxf_tools\bmxtranswrap.exe" -t rdd9 -o "%s_source%_rewrapped.mxf" %s_source%_transcoded.mxf"
Lemme know if this is what you need!

Re: GOP header timecode

Posted: Mon Nov 08, 2021 4:30 pm
by Ghtais
Hi Emcodem


Thank for the code. I missed to add the output file name at the end ! :D it should explain why it gave me an error :)
concerning the quatization, peharps I'am wrong, but I don't think it changes the stream bitrate.
In the example above, you can see that it gives more bitrate to I frame but in the same time it reduces the B frame to keep the same stream bitrate.
I think this choice depends on the complexity of the input file, peharps a too much lower bitrate for B Frame can have negative impact on the final file. I have to make other tests and perhaps we could merge our results on the forum :)