[Cin] mpeg2 encoding with ffmpeg (for dvd, from doom9 forums)

Andrew Randrianasulu randrianasulu at gmail.com
Sun Nov 21 10:17:11 CET 2021


On Sunday, November 21, 2021, Andrew Randrianasulu <randrianasulu at gmail.com>
wrote:

> I found few ffmpeg/mpeg2 related threads but nothing about mpeg2/bluray
> encoding
>
> https://forum.doom9.org/showthread.php?t=173332
> ====
> Quote:
> ffmpeg.exe -i # -aspect # -dc 10 -g 12 -maxrate 8000k -q:v 2 -b_strategy 2
> -brd_scale 2 -bf 2 -profile:v 4 -intra_matrix "8,16,19,22,26,27,29,34,16,16,
> 22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,
> 37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,
> 29,34,38,46,56,69,27,29,35,38,46,56,69,83" -inter_matrix
> "16,17,18,19,20,21,22,23,17,18,19,20,21,22,23,24,18,19,20,
> 21,22,23,24,25,19,20,21,22,23,24,26,27,20,21,22,23,25,26,27,
> 28,21,22,23,24,26,27,28,30,22,23,24,26,27,28,30,31,23,24,25,27,28,30,31,33"
> -pass 1 -passlogfile "ffmpeg" -an -c:v mpeg2video pass1.m2v"
>
> ffmpeg.exe -i # -aspect # -dc 10 -g 12 -lmin 0.75 -mblmin 50 -qmin 1 -qmax
> 31 -maxrate 8000k -b:v 3500k -bf 2 -pre_dia_size 5 -dia_size 5 -qcomp 0.7
> -qblur 0 -preme 2 -me_method dia -sc_threshold 0 -sc_factor 4 -bidir_refine
> 4 -profile:v 4 -mbd rd -mbcmp satd -precmp satd -cmp satd -subcmp satd
> -skipcmp satd -intra_matrix "8,16,19,22,26,27,29,34,16,16,
> 22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,
> 37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,
> 29,34,38,46,56,69,27,29,35,38,46,56,69,83" -inter_matrix
> "16,17,18,19,20,21,22,23,17,18,19,20,21,22,23,24,18,19,20,
> 21,22,23,24,25,19,20,21,22,23,24,26,27,20,21,22,23,25,26,27,
> 28,21,22,23,24,26,27,28,30,22,23,24,26,27,28,30,31,23,24,25,27,28,30,31,33"
> -pass 2 -passlogfile "ffmpeg" -an -c:v mpeg2video out.m2v
>
> Just replace the # characters with your own values, maybe play with the
> bitrate...
>
> ===
>
> I never used those custom matrix params - someone with better eyesight
> (and low error-tolerance :-}) can check them..
>
> about dvb-t muxing
> http://www.waveguide.se/?article=creating-dvb-t-compatible-mpeg2-streams-
> using-ffmpeg
>
> http://forum.doom9.net/showthread.php?t=174620
>
> ===
>
>
> new-ish dvd encode with ffmpeg thread making use of negative sc_threshold
> value for less artefacting in areas with high motion. Not sure if our
> ffmpeg 4.4 still respects this.
>
> @REM Threshold for scene change detection (sc_threshold)
> [−1000000000;1000000000] (Negative values indicate that it is more likely
> to insert an I-frame when it detects a scene change)
> set E_TSD=-30000
>
> ===
>
>
> also, dc precision should be higher for higher bitrates (dc 12 for max?)
> ..
>


err, 11 max...

I tried to create mpeg2 two-pass video profiles according to

https://cinelerra-gg.org/download/CinelerraGG_Manual/Two_pass_Encoding_with_FFmp.html

and info above

see attached (I tested those on android, so cin_stat_file must be altered
for more generic logfile location)

Note, second pass will crash if logfile was not created or removed...

>
> As starting point  for first shot just increase bitrates to BD-levels?
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20211121/17dc6f0d/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pass1of2_mpeg2.mpeg
Type: video/mpeg
Size: 666 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20211121/17dc6f0d/attachment.mpeg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pass2of2_mpeg2.mpeg
Type: video/mpeg
Size: 842 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20211121/17dc6f0d/attachment-0001.mpeg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpeg2_hq.mpeg
Type: video/mpeg
Size: 90 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20211121/17dc6f0d/attachment-0002.mpeg>


More information about the Cin mailing list