[Cin] Blu-ray encoding again

Phyllis Smith phylsmith2017 at gmail.com
Fri Oct 16 03:24:02 CEST 2020


Andrew,
GG has been working on an integration of some of the ffmpeg Blu-ray patches
because it looks like they have stabilized.  He checked in final patches to
GIT which incorporated what worked so things are cleaner and more similar
now.  We tested on 2 different bluray viewing devices and encountered no
problems.  This was worked on for about 3 days but should be done now for
awhile anyway.  I know this is a low use Cinelerra feature BUT we use it
ourselves so it is important to us.

With Marton's patches from git clone -b mpegts
> https://github.com/cus/ffmpeg/
> and CinGG compiled with ffmpg.git I _nearly_ got some rendering.
>
> But option files still needed some modification
>
> For example I was running into x264 errors.
>
> cin
> Cinelerra Infinity - built: Nov 14 2019 14:17:05
> git://git.cinelerra-gg.org/goodguy/cinelerra.git
> (c) 2006-2019 Heroine Virtual Ltd. by Adam Williams
> (c) 2007-2019 cin5 derivative by W.P. Morrow aka goodguy
> Cinelerra is free software, covered by the GNU General Public License,
> and you are welcome to change it and/or distribute copies of it under
> certain conditions. There is absolutely no warranty for Cinelerra.
>
> Device type none is not supported.
> Available device types: vdpau cuda vaapi opencl
> Device type none is not supported.
> Available device types: vdpau cuda vaapi opencl
> Device type none is not supported.
> Available device types: vdpau cuda vaapi opencl
> Device type none is not supported.
> Available device types: vdpau cuda vaapi opencl
> [libx264 @ 0xe9a3c4c0] interlace + weightp is not implemented
> [libx264 @ 0xe9a3c4c0] using mv_range_thread = 88
> [libx264 @ 0xe9a3c4c0] NAL HRD parameters require VBV parameters
> [libx264 @ 0xe9a3c4c0] using SAR=1/1
> [libx264 @ 0xe9a3c4c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
> AVX XOP FMA3 BMI1
> [libx264 @ 0xe9a3c4c0] profile High, level 4.1
> Device type none is not supported.
> Available device types: vdpau cuda vaapi opencl
> FFMPEG::encode_activate: write header failed
> /dev/shm//bd_20191114-163217/bd.m2ts
>   err: Недопустимый аргумент
> Render::render_single: Session finished.
> Device type none is not supported.
> Available device types: vdpau cuda vaapi opencl
>
>
> some of them were fixed by applying parameters from
>
> http://www.x264bluray.com/home/1080i-p
>
> [libx264 @ 0xe0609640] using mv_range_thread = 88
> [libx264 @ 0xe0609640] using SAR=1/1
> [libx264 @ 0xe0609640] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
> AVX XOP FMA3 BMI1
> [libx264 @ 0xe0609640] HRD bitrate: 40000000 bits/sec
> [libx264 @ 0xe0609640] CPB size: 30000000 bits
> [libx264 @ 0xe0609640] profile High, level 4.1
> [SWR @ 0xcfba81c0] Using fltp internally between filters
> Device type none is not supported.
> Available device types: vdpau cuda vaapi opencl
> Render::render_single: Session finished.
>
> but there still warning at ffmpeg site about deprecation of x264opts:
>
> https://trac.ffmpeg.org/wiki/Encode/H.264
> Warning: Do not use the option x264opts, as it will eventually be removed.
> Use x264-params instead.
>
> ---
> /usr/share/cin/ffmpeg/video/bluray.m2ts
>
>                          417/417               100%
> bluray libx264
> bluray-compat=1
> id=0x1011
> level=41
> bf=2
> fake-interlaced=1
> bitrate=40000
> slices=4
> sar=1:1
> # vbv-maxrate=40000
> # vbv-bufsize=30000
> refs=3
> cin_pix_fmt=yuv420p
> color_range=mpeg
> colorspace=bt709
> color_trc=bt709
> color_primaries=bt709
> profile=high
> preset=medium
> flags=+cgop
> # must be last for bdcreate.C
> x264opts
> keyint=25:min-keyint=4:qpmin=3:qpmax=33:qp_step=4:merange=8:vbv-maxrate=40000:vbv-bufsize=30000
>
> ---
> /usr/share/cin/ffmpeg/format/bluray
>
>                          129/129               100%
> mpegts
> mpegts_m2ts_mode=1
> mpegts_start_pid=1024
> mpegts_pmt_start_pid=256
> muxrate 1
> #sdt_period=-1
> packetsize 2048
> preload 500000
>
>
> But please note some x264 params actually should vary for interlaced or
> progressive, 25 vs 30 fps:
>
> 1080p
> Primary and Secondary Streams
>
> 1080p23.976 / 1080p24
>
> x264 --bitrate XXXXX --preset veryslow --tune film --bluray-compat
> --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 24 --open-gop
> --slices 4 --colorprim "bt709" --transfer "bt709" --colormatrix "bt709"
> --sar 1:1 --pass 1 -o out.264 input.file
>
> x264 --bitrate XXXXX --preset veryslow --tune film --bluray-compat
> --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 24 --open-gop
> --slices 4 --colorprim "bt709" --transfer "bt709" --colormatrix "bt709"
> --sar 1:1 --pass 2 -o out.264 input.file
>
> NB: the following two streams are encoded using fake-interlaced mode. This
> allows the stream to be encoded progressively yet flagged as interlaced.
>
> 1080p25
>
> x264
> --bitrate XXXXX --preset veryslow --tune film --bluray-compat
> --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 25
> --open-gop
> --slices 4 --fake-interlaced
> --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1
> --pass 1 -o out.264
> input.file
>
> x264
> --bitrate XXXXX --preset veryslow --tune film --bluray-compat
> --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 25
> --open-gop
> --slices 4 --fake-interlaced
> --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1
> --pass 2 -o out.264
> input.file
>
> 1080p29.97
>
> x264
> --bitrate XXXXX
> --preset veryslow --tune film --bluray-compat --vbv-maxrate 40000
> --vbv-bufsize 30000 --level 4.1 --keyint 30
> --open-gop
> --slices 4 --fake-interlaced
> --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1
> --pass 1 -o out.264
> input.file
>
> x264
> --bitrate XXXXX
> --preset veryslow --tune film --bluray-compat --vbv-maxrate 40000
> --vbv-bufsize 30000 --level 4.1 --keyint 30 --open-gop --slices 4
> --fake-interlaced --colorprim "bt709" --transfer "bt709" --colormatrix
> "bt709" --sar 1:1 --pass 2 -o out.264 input.file
>
> 1080i
> Primary and Secondary Streams (assumes top field first)
>
> 1080i25
>
> x264
> --bitrate XXXXX
> --preset veryslow --tune film --bluray-compat --vbv-maxrate 40000
> --vbv-bufsize 30000 --level 4.1 --keyint 25 --open-gop --slices 4 --tff
> --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1
> --pass 1 -o out.264
> input.file
>
> x264
> --bitrate XXXXX
> --preset veryslow --tune film --bluray-compat --vbv-maxrate 40000
> --vbv-bufsize 30000 --level 4.1 --keyint 25 --open-gop --slices 4 --tff
> --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1
> --pass 2 -o out.264
> input.file
>
> 1080i29.97 / 1080i30
>
> x264
> --bitrate XXXXX
> --preset veryslow --tune film --bluray-compat --vbv-maxrate 40000
> --vbv-bufsize 30000 --level 4.1 --keyint 30 --open-gop --slices 4 --tff
> --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1
> --pass 1 -o out.264
> input.file
>
> x264
> --bitrate XXXXX
> --preset veryslow --tune film --bluray-compat --vbv-maxrate 40000
> --vbv-bufsize 30000 --level
>  4.1 --keyint 30 --open-gop --slices 4 --tff --colorprim "bt709"
> --transfer "bt709" --colormatrix "bt709" --sar 1:1 --pass 2 -o out.264
> input.file
>
> so, keyint must be dynamically-selected, depending on profile you (user)
> choose,
> and fake_interlaced must be present for progressive encodings
>
> More on those constrains, refering  same page:
> https://av.community/guides/encoding-video-for-blu-ray-using-h264-avc/
>
> "8-bit (4:2:0) Colorspace is only allowed
> Main and High profiles are allowed
> Maximum 3 B-Frames is allowed
> NAL-HRD Type 2 capable encoder is needed"
>
> note, according to some comments around vbv-bufsize you can mux to DVD, so
> test this, too?
> "vbv-maxrate Maximum allowed bitrate. Depend of destination media, for
> normal BD Media,
> maximum settings is allowed (40000), while for DVD Media (eg BD-5 or BD-9)
> there is no
> maximum per Blu-Ray specification, but is strongly recommended that use
> less
> or equal to 15000, since DVD reading is slower."
> --
> Cin mailing list
> Cin at lists.cinelerra-gg.org
> https://lists.cinelerra-gg.org/mailman/listinfo/cin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20201015/cd9abe7d/attachment.htm>


More information about the Cin mailing list