[x265] [POSSIBLE BUG] pbratio value always assumed 1 in 2-pass mode

Marcin Jaworski ptrck.stewart at googlemail.com
Wed Mar 18 13:38:46 UTC 2026


Hello.


(I've tried to submit a bug report through GitHub's "Report an issue" 
link, but it returns "Error 404" even when I'm logged in.)

"--pbratio", whether it's implicit or specified directly in the command 
line, doesn't seem to work in 2-pass mode (it works fine in CRF mode). 
It always seems to assume "--pbratio 1" (P-frame quantizers are equal to 
B-frame quantizers), even though MediaInfo reports "pbratio=1.30" in the 
output file's metadata. It causes significant quality degradation.

The problem affects all versions from 4.1+191, possibly even earlier 
versions (4.1+54 is OK) regardless of the compiler (GCC, ICC, MSVC, 
CLang). Tested on a Windows 11 Home PC with Intel i3 13100F CPU with 
AVX2 builds from http://msystem.waw.pl/x265 and 
https://github.com/Patman86/x265-Mod-by-Patman/releases.

Version 4.1+239 2nd Pass output:
---[Information] [17.03.2026 17:35:34] x265 [info]: frame I:    120, Avg 
QP:22.37  kb/s: 3578.02   SSIM Mean: 0.987618 (19.072dB)
---[Information] [17.03.2026 17:35:34] x265 [info]: frame P:  1399, Avg 
QP:24.88  kb/s: 1094.13   SSIM Mean: 0.983825 (17.911dB)
---[Information] [17.03.2026 17:35:34] x265 [info]: frame B:  4881, Avg 
QP:25.47  kb/s: 382.43    SSIM Mean: 0.983415 (17.803dB)

Version 4.1+54 2nd Pass output:
---[Information] [17.03.2026 17:26:52] x265 [INFO]: frame I:    118, Avg 
QP:18.96  kb/s: 4471.94   SSIM Mean: 0.990041 (20.018dB)
---[Information] [17.03.2026 17:26:52] x265 [INFO]: frame P:  1408, Avg 
QP:21.83  kb/s: 1405.90   SSIM Mean: 0.988389 (19.351dB)
---[Information] [17.03.2026 17:26:52] x265 [INFO]: frame B:  4874, Avg 
QP:28.10  kb/s: 273.93    SSIM Mean: 0.986488 (18.693dB)

Example command lines to reproduce the bug:

"cmd.exe" /c ""C:\Program Files\MeGUI\tools\ffmpeg\ffmpeg.exe" -loglevel 
level+error -hide_banner -i "D:\comptest_239.avs" -strict -1 -f 
yuv4mpegpipe - | "C:\Program Files\MeGUI\tools\x265\x64\x265.exe" 
--preset slow --pass 1 --bitrate 600 --stats "D:\comptest_239.stats" 
--amp --weightb --b-intra --rc-lookahead 240 --ctu 32 --psy-rd 1.0 
--tskip --fades --aq-mode 1 --deblock=-1:-1 --ref 8 --bframes 16 -I 240 
--limit-sao --selective-sao 4 --sao-non-deblock --no-open-gop --ssim -P 
main10 --level-idc 3 --videoformat 0 --range limited --chromaloc 0 
--multi-pass-opt-analysis --multi-pass-opt-distortion 
--analysis-reuse-file "D:\Temp\x265\2pastest.dat" --colorprim smpte170m 
--transfer smpte170m --colormatrix smpte170m --vbv-bufsize 6000 
--vbv-maxrate 6000 --sar 1:1 --output NUL --frames 6400 --y4m --input -"

"cmd.exe" /c ""C:\Program Files\MeGUI\tools\ffmpeg\ffmpeg.exe" -loglevel 
level+error -hide_banner -i "D:\comptest_239.avs" -strict -1 -f 
yuv4mpegpipe - | "C:\Program Files\MeGUI\tools\x265\x64\x265.exe" 
--preset slow --pass 2 --bitrate 600 --stats "D:\comptest_239.stats" 
--amp --weightb --b-intra --rc-lookahead 240 --ctu 32 --psy-rd 1.0 
--tskip --fades --aq-mode 1 --deblock=-1:-1 --ref 8 --bframes 16 -I 240 
--limit-sao --selective-sao 4 --sao-non-deblock --no-open-gop --ssim -P 
main10 --level-idc 3 --videoformat 0 --range limited --chromaloc 0 
--multi-pass-opt-analysis --multi-pass-opt-distortion 
--analysis-reuse-file "D:\Temp\x265\2pastest.dat" --colorprim smpte170m 
--transfer smpte170m --colormatrix smpte170m --vbv-bufsize 6000 
--vbv-maxrate 6000 --sar 1:1 --output "D:\comptest_239.hevc" --frames 
6400 --y4m --input -"


Regards,
Jawor




More information about the x265-devel mailing list