Commit bb9b16b4 authored by Committed by Fiona GlaserBrowse files
Blu-ray support: NAL-HRD, VFR ratecontrol, filler, pulldown
x264 can now generate Blu-ray-compliant streams for authoring Blu-ray Discs! Compliance tested using Sony BD-ROM Verifier 1.21. Thanks to The Criterion Collection for sponsoring compliance testing! An example command, using constant quality mode, for 1080p24 content: x264 --crf 16 --preset veryslow --tune film --weightp 0 --bframes 3 --nal-hrd vbr --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 24 --b-pyramid strict --slices 4 --aud --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1 <input> -o <output> This command is much more complicated than usual due to the very complicated restrictions the Blu-ray spec has. Most options after "tune" are required by the spec. --weightp 0 is not, but there are known bugged Blu-ray player chipsets (Mediatek, notably) that will decode video with --weightp 1 or 2 incorrectly. Furthermore, note the Blu-ray spec has very strict limitations on allowed resolution/fps combinations. Examples include 1080p @ 24000/1001fps (NTSC FILM) and 720p @ 60000/1001fps. Detailed features introduced in this patch: Full NAL-HRD compliance, with both VBR (no filler) and CBR (filler) modes. Can be enabled with --nal-hrd vbr/cbr. libx264 now returns HRD timing information to the caller in the form of an x264_hrd_t. x264cli doesn't currently use it, but this information is critical for compliant TS muxing. Full VFR ratecontrol support: VBV, 1-pass ABR, and 2-pass modes. This means that, even without knowing the average framerate, x264 can achieve a correct bitrate in target bitrate modes. Note that this changes the statsfile format; first pass encodes make before this patch will have to be re-run. Pulldown support: libx264 allows the calling application to specify a pulldown mode for each frame. This is similar to the way that RFFs (Repeat Field Flags) work in MPEG-2. Note that libx264 does not modify timestamps: it assumes the calling application has set timestamps correctly for pulldown! x264cli contains an example implementation of caller-side pulldown code. Pic_struct support: necessary for pulldown and allows interlaced signalling. Also signal TFF vs BFF with delta_poc_bottom: should significantly improve interlaced compression. --tff and --bff should be preferred to the old --interlaced in order to tell x264 what field order to use. Huge thanks to Alex Giladi and Lamont Alston for their work on code that eventually became part of this patch.