View Full Version : x264 Preset settings not correct?
Fishman0919
15th April 2019, 17:29
I encode my videos mostly using Preset Slower or Veryslow but I've noticed that the number of --ref frames are not correct. Slower should have --ref 8 and it encodes with --ref 4, veryslow should have --ref 16 but you get --ref 4... and the same for Placebo.
I've noticed this in a few variants of x264... Handbrake/ A.K.A Vidcoder, ffmpeg and x264.exe.
I was wondering, was this changed and not updated in the Full Help or a bug?
Groucho2004
15th April 2019, 17:58
I encode my videos mostly using Preset Slower or Veryslow but I've noticed that the number of --ref frames are not correct. Slower should have --ref 8 and it encodes with --ref 4, veryslow should have --ref 16 but you get --ref 4... and the same for Placebo.
I've noticed this in a few variants of x264... Handbrake/ A.K.A Vidcoder, ffmpeg and x264.exe.
I was wondering, was this changed and not updated in the Full Help or a bug?Post your complete command line. Some switches, for example "bluray-compat", will override the specified number of ref frames.
Fishman0919
15th April 2019, 18:28
Post your complete command line. Some switches, for example "bluray-compat", will override the specified number of ref frames.
"D:\RipBot264v1.22.0\Tools\ffmpeg\bin\ffmpeg.exe" -loglevel panic -i "C:\Temp\RipBot264temp\job2\job2.avs" -strict -1 -f yuv4mpegpipe - | "D:\RipBot264v1.22.0\tools\x264\x264_x64.exe" --crf 20 --fps 24000/1001 --min-keyint 24 --keyint 240 --frames 111487 --sar 1:1 --level 4.0 --preset veryslow --aq-mode 3 --aq-strength 0.85 --stdin y4m --output "C:\Temp\RipBot264temp\video.264" -
Same settings for the other variants, handbrake and ffmpeg, with same results.
General
Complete name : C:\Temp\RipBot264temp\video.264
Format : AVC
Format/Info : Advanced Video Codec
File size : 1.86 MiB
Duration : 6 s 757 ms
Overall bit rate : 2 308 kb/s
Writing library : x264 core 157 r2969 d4099dd
Encoding settings : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=3:0.85
Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, RefFrames : 4 frames
Duration : 6 s 757 ms
Bit rate : 2 308 kb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.046
Stream size : 1.81 MiB (98%)
Writing library : x264 core 157 r2969 d4099dd
Encoding settings : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=3:0.85
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Fishman0919
15th April 2019, 18:40
without aq-mode 3
"D:\RipBot264v1.22.0\Tools\ffmpeg\bin\ffmpeg.exe" -loglevel panic -i "C:\Temp\RipBot264temp\job2\job2.avs" -strict -1 -f yuv4mpegpipe - | "D:\RipBot264v1.22.0\tools\x264\x264_x64.exe" --crf 20 --fps 24000/1001 --min-keyint 24 --keyint 240 --frames 111487 --sar 1:1 --level 4.0 --preset veryslow --stdin y4m --output "C:\Temp\RipBot264temp\video.264" -
General
Complete name : C:\Temp\RipBot264temp\video.264
Format : AVC
Format/Info : Advanced Video Codec
File size : 1.10 MiB
Duration : 4 s 546 ms
Overall bit rate : 2 025 kb/s
Writing library : x264 core 157 r2969 d4099dd
Encoding settings : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, RefFrames : 4 frames
Duration : 4 s 546 ms
Bit rate : 2 025 kb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.041
Stream size : 1.07 MiB (97%)
Writing library : x264 core 157 r2969 d4099dd
Encoding settings : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Andouille
15th April 2019, 18:52
IIRC level 4.0 only supports 4 ref frames for 1920x1080.
AND you are forcing 4.0 level...
Fishman0919
15th April 2019, 18:59
no, only difference between level 4.0 and 4.1, that I know of, is --vbv-bufsize and --vbv-maxrate
"D:\RipBot264v1.22.0\Tools\ffmpeg\bin\ffmpeg.exe" -loglevel panic -i "C:\Temp\RipBot264temp\job2\job2.avs" -strict -1 -f yuv4mpegpipe - | "D:\RipBot264v1.22.0\tools\x264\x264_x64.exe" --crf 20 --fps 24000/1001 --min-keyint 24 --keyint 240 --frames 111487 --sar 1:1 --level 4.1 --preset veryslow --stdin y4m --output "C:\Temp\RipBot264temp\video.264" -
General
Complete name : C:\Temp\RipBot264temp\video.264
Format : AVC
Format/Info : Advanced Video Codec
File size : 1 000 KiB
Duration : 4 s 254 ms
Overall bit rate : 1 926 kb/s
Writing library : x264 core 157 r2969 d4099dd
Encoding settings : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, RefFrames : 4 frames
Duration : 4 s 254 ms
Bit rate : 1 926 kb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.039
Stream size : 1 000 KiB (100%)
Writing library : x264 core 157 r2969 d4099dd
Encoding settings : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Groucho2004
15th April 2019, 19:16
no, only difference between level 4.0 and 4.1, that I know of, is --vbv-bufsize and --vbv-maxrate
Level 4.1:
1080p: 4 refs
720p : 9 refs
Fishman0919
15th April 2019, 19:21
Level 4.1:
1080p: 4 refs
720p : 9 refs
Yes, just found that... Thank You!
zub35
24th April 2019, 17:36
ref=MaxDpbMbs/(x*y) - we round down (if 4.99 then 4)
x=width/16 | y=height/16 - we round up (if 80.01 then 81)
level - MaxDpbMbs
3.0 - 8100 (480p30)
3.1 - 18000 (720p30)
3.2 - 20480 (720p60)
4.0 - 32768 (1080p30)
4.1 - 32768 (1080p30)
4.2 - 34816 (1080p60)
5.0 - 110400 (2560x1920p30)
5.1 - 184320 (2160p30)
5.2 - 184320 (2160p60)
level - vbv-maxrate and vbv-bufsize (Profile: Baseline-Main | High | High 10 | High 422-444)
3.0 - 10000 12500 30000 40000
3.1 - 14000 17500 42000 56000
3.2 - 20000 25000 60000 80000
4.0 - 20000 25000 60000 80000
4.1 - 50000 62500 150000 200000
4.2 - 50000 62500 150000 200000
5.0 - 135000 168750 405000 540000
5.1 - 240000 300000 720000 960000
If you specify a --level and --preset, then the --ref is calculated automatically!
but no more than stipulated by --preset
It is strange that the codec does not do automatic --vbv-maxrate and --vbv-bufsize, if --level and --profile (and --bluray-compat) is specified :(
This will help to avoid many problems when a low CRF value is indicated.
sneaker_ger
24th April 2019, 21:33
level - vbv-maxrate and vbv-bufsize (Profile: Baseline-Main | High | High 10 | High 422-444)
3.0 - 10000 12500 30000 40000
3.1 - 14000 17500 42000 56000
3.2 - 20000 25000 60000 80000
4.0 - 20000 25000 60000 80000
4.1 - 50000 62500 150000 200000
4.2 - 50000 62500 150000 200000
5.0 - 135000 168750 405000 540000
5.1 - 240000 300000 720000 960000
Those are the vbv maxrate values only. vbv bufsize can be different.
https://i.imgur.com/SRLQywt.png
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.