FranceBB
5th April 2022, 15:33
Hi there,
a client is asking us to deliver files at 500 Mbit/s CBR with 8 slices, no motion compensation (i.e ref 1, keyint 1), profile High 4:2:2 10bit planar, Level 5.2 with audio mono PCM 24bit 48'000Hz and container mxf with timecode set to a fixed value they asked, namely 20:45:00:16.
I complied to the request with:
x264.exe "\\mibctvan000\Ingest\MEDIA\temp\AVS Script.avs" --preset medium --profile high422 --level 5.2 --keyint 1 --no-cabac --slices 8 --bitrate 500000 --vbv-maxrate 500000 --vbv-bufsize 500000 --deblock -1:-1 --overscan show --colormatrix bt2020nc --range tv --log-level info --thread-input --transfer arib-std-b67 --colorprim bt2020 --videoformat component --nal-hrd cbr --output-csp i422 --output-depth 10 --output "\\mibctvan000\Ingest\MEDIA\temp\raw_video.h264"
and then I used FFMpeg and BBC BMX to mux the audio so that the encoded file is:
General
Complete name : \\mibcuvnex001\Edit\File.mxf
Format : MXF
Format version : 1.3
Format profile : OP-1a
Format settings : Closed / Complete
File size : 482 GiB
Duration : 2 h 13 min
Overall bit rate : 519 Mb/s
Encoded date : 2022-03-09 18:16:54.908
Writing application : BBC bmx 0.1.3.0.2
Writing library : libMXF (Win32) 1.0.3.0.2
Video
ID : 1001
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High 4:2:2 Intra@L5.2
Format settings, CABAC : No
Format settings, GOP : N=1
Format settings, wrapping mode : Frame
Codec ID : 0D01030102106001-0401020201323001
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 500 Mb/s
Width : 3 840 pixels
Height : 2 160 pixels
Display aspect ratio : 16:9
Frame rate : 50.000 FPS
Color space : YUV
Chroma subsampling : 4:2:2
Bit depth : 10 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 1.206
Stream size : 465 GiB (96%)
Title : V1
Writing library : x264 core 164 r3079 d9a19f0
Encoding settings : cabac=0 / ref=1 / deblock=1:-1:-1 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=30 / lookahead_threads=5 / sliced_threads=0 / slices=8 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=0 / weightp=0 / keyint=1 / keyint_min=1 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=cbr / mbtree=0 / bitrate=500000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=81 / qpstep=4 / vbv_maxrate=500000 / vbv_bufsize=500000 / nal_hrd=cbr / filler=1 / ip_ratio=1.40 / aq=1:1.00
Color range : Limited
Color primaries : BT.2020
Transfer characteristics : HLG
Matrix coefficients : BT.2020 non-constant
Audio #1
ID : 2001
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 24 bits
Stream size : 2.14 GiB (0%)
Title : A1
Locked : Yes
Audio #2
ID : 2002
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 24 bits
Stream size : 2.14 GiB (0%)
Title : A2
Locked : Yes
Audio #3
ID : 2003
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 24 bits
Stream size : 2.14 GiB (0%)
Title : A3
Locked : Yes
Audio #4
ID : 2004-1
Format : Dolby E
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Muxing mode : SMPTE ST 337
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 1 291 kb/s
Channel(s) : 6 channels
Channel layout : L C Ls X R LFE Rs X
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 20 bits
Delay relative to video : -20 h 45 min
Stream size : 1.20 GiB (0%)
Title : Dolby E world
Original frame rate : 25.000
Locked : Yes
Audio #5
ID : 2004-2
Format : Dolby E
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Muxing mode : SMPTE ST 337
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 505 kb/s
Channel(s) : 2 channels
Channel layout : X X X L X X X R
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 20 bits
Delay relative to video : -20 h 45 min
Stream size : 481 MiB (0%)
Title : Dolby E world
Original frame rate : 25.000
Locked : Yes
Audio #6
ID : 2005
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 24 bits
Stream size : 2.14 GiB (0%)
Title : A5
Locked : Yes
Audio #7
ID : 2006
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 24 bits
Stream size : 2.14 GiB (0%)
Title : A6
Locked : Yes
Audio #8
ID : 2007
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 24 bits
Stream size : 2.14 GiB (0%)
Title : A7
Locked : Yes
Audio #9
ID : 2008
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 24 bits
Stream size : 2.14 GiB (0%)
Title : A8
Locked : Yes
Other #1
ID : 901-Material
Type : Time code
Format : MXF TC
Frame rate : 50.000 FPS
Time code of first frame : 20:45:00:16
Time code settings : Material Package
Time code, striped : Yes
Title : TC1
Other #2
ID : 901-Source
Type : Time code
Format : MXF TC
Frame rate : 50.000 FPS
Time code of first frame : 20:45:00:16
Time code settings : Source Package
Time code, striped : Yes
Title : TC1
Unfortunately, though, the file got rejected.
The official reason reported by the studio I sent the file to is "Play Exception - Read too large for buffer" and "Determine Buffer Alignment Error in DID Reader".
Although the message is a bit cryptic, it looks like it's a buffer issue and indeed when I took a look at the file with BitrateViewer, it was anything but CBR:
https://i.imgur.com/Cy2DjsQ.png
The peak of 718 Mbit/s is FAR FAR higher than the 500 Mbit/s required, therefore the poor hardware playback port must have been struggling to cache it in memory and decode it properly, hence creating the issue.
Is there an option I'm missing in x264 to sort of force it to have a much stricter bitrate cap with as little oscillations as possible?
I'm currently relying on
--bitrate 500000 --vbv-maxrate 500000 --vbv-bufsize 500000 --nal-hrd cbr
to output a CBR; too bad it oscillates a bit too much :(
Any suggestions? (I can provide a short sample if needed).
a client is asking us to deliver files at 500 Mbit/s CBR with 8 slices, no motion compensation (i.e ref 1, keyint 1), profile High 4:2:2 10bit planar, Level 5.2 with audio mono PCM 24bit 48'000Hz and container mxf with timecode set to a fixed value they asked, namely 20:45:00:16.
I complied to the request with:
x264.exe "\\mibctvan000\Ingest\MEDIA\temp\AVS Script.avs" --preset medium --profile high422 --level 5.2 --keyint 1 --no-cabac --slices 8 --bitrate 500000 --vbv-maxrate 500000 --vbv-bufsize 500000 --deblock -1:-1 --overscan show --colormatrix bt2020nc --range tv --log-level info --thread-input --transfer arib-std-b67 --colorprim bt2020 --videoformat component --nal-hrd cbr --output-csp i422 --output-depth 10 --output "\\mibctvan000\Ingest\MEDIA\temp\raw_video.h264"
and then I used FFMpeg and BBC BMX to mux the audio so that the encoded file is:
General
Complete name : \\mibcuvnex001\Edit\File.mxf
Format : MXF
Format version : 1.3
Format profile : OP-1a
Format settings : Closed / Complete
File size : 482 GiB
Duration : 2 h 13 min
Overall bit rate : 519 Mb/s
Encoded date : 2022-03-09 18:16:54.908
Writing application : BBC bmx 0.1.3.0.2
Writing library : libMXF (Win32) 1.0.3.0.2
Video
ID : 1001
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High 4:2:2 Intra@L5.2
Format settings, CABAC : No
Format settings, GOP : N=1
Format settings, wrapping mode : Frame
Codec ID : 0D01030102106001-0401020201323001
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 500 Mb/s
Width : 3 840 pixels
Height : 2 160 pixels
Display aspect ratio : 16:9
Frame rate : 50.000 FPS
Color space : YUV
Chroma subsampling : 4:2:2
Bit depth : 10 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 1.206
Stream size : 465 GiB (96%)
Title : V1
Writing library : x264 core 164 r3079 d9a19f0
Encoding settings : cabac=0 / ref=1 / deblock=1:-1:-1 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=30 / lookahead_threads=5 / sliced_threads=0 / slices=8 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=0 / weightp=0 / keyint=1 / keyint_min=1 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=cbr / mbtree=0 / bitrate=500000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=81 / qpstep=4 / vbv_maxrate=500000 / vbv_bufsize=500000 / nal_hrd=cbr / filler=1 / ip_ratio=1.40 / aq=1:1.00
Color range : Limited
Color primaries : BT.2020
Transfer characteristics : HLG
Matrix coefficients : BT.2020 non-constant
Audio #1
ID : 2001
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 24 bits
Stream size : 2.14 GiB (0%)
Title : A1
Locked : Yes
Audio #2
ID : 2002
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 24 bits
Stream size : 2.14 GiB (0%)
Title : A2
Locked : Yes
Audio #3
ID : 2003
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 24 bits
Stream size : 2.14 GiB (0%)
Title : A3
Locked : Yes
Audio #4
ID : 2004-1
Format : Dolby E
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Muxing mode : SMPTE ST 337
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 1 291 kb/s
Channel(s) : 6 channels
Channel layout : L C Ls X R LFE Rs X
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 20 bits
Delay relative to video : -20 h 45 min
Stream size : 1.20 GiB (0%)
Title : Dolby E world
Original frame rate : 25.000
Locked : Yes
Audio #5
ID : 2004-2
Format : Dolby E
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Muxing mode : SMPTE ST 337
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 505 kb/s
Channel(s) : 2 channels
Channel layout : X X X L X X X R
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 20 bits
Delay relative to video : -20 h 45 min
Stream size : 481 MiB (0%)
Title : Dolby E world
Original frame rate : 25.000
Locked : Yes
Audio #6
ID : 2005
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 24 bits
Stream size : 2.14 GiB (0%)
Title : A5
Locked : Yes
Audio #7
ID : 2006
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 24 bits
Stream size : 2.14 GiB (0%)
Title : A6
Locked : Yes
Audio #8
ID : 2007
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 24 bits
Stream size : 2.14 GiB (0%)
Title : A7
Locked : Yes
Audio #9
ID : 2008
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 2 h 13 min
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 50.000 FPS (960 SPF)
Bit depth : 24 bits
Stream size : 2.14 GiB (0%)
Title : A8
Locked : Yes
Other #1
ID : 901-Material
Type : Time code
Format : MXF TC
Frame rate : 50.000 FPS
Time code of first frame : 20:45:00:16
Time code settings : Material Package
Time code, striped : Yes
Title : TC1
Other #2
ID : 901-Source
Type : Time code
Format : MXF TC
Frame rate : 50.000 FPS
Time code of first frame : 20:45:00:16
Time code settings : Source Package
Time code, striped : Yes
Title : TC1
Unfortunately, though, the file got rejected.
The official reason reported by the studio I sent the file to is "Play Exception - Read too large for buffer" and "Determine Buffer Alignment Error in DID Reader".
Although the message is a bit cryptic, it looks like it's a buffer issue and indeed when I took a look at the file with BitrateViewer, it was anything but CBR:
https://i.imgur.com/Cy2DjsQ.png
The peak of 718 Mbit/s is FAR FAR higher than the 500 Mbit/s required, therefore the poor hardware playback port must have been struggling to cache it in memory and decode it properly, hence creating the issue.
Is there an option I'm missing in x264 to sort of force it to have a much stricter bitrate cap with as little oscillations as possible?
I'm currently relying on
--bitrate 500000 --vbv-maxrate 500000 --vbv-bufsize 500000 --nal-hrd cbr
to output a CBR; too bad it oscillates a bit too much :(
Any suggestions? (I can provide a short sample if needed).