Log in

View Full Version : Help understanding results from aqmode4 vs 2 and sao


lucasrj2002
27th August 2023, 16:23
Hello everyone, thanks for reading. I'm just a hobbyist trying to learn.

I encoded an episode of Star Trek Strange New Worlds. Its a very clean, 4k native source material. Media Info states the HEVC bitrate is 66.3Mbps, file size 27GB.

I encoded it with two settings to compare and contrast the output. The final file sizes were very different (4GB vs 18.5GB), as were the HEVC bit rates (10.2Mbps vs 44.4Mbps).

Both were done using preset slow and CRF 15. The main differences were aq-modes (4 vs 2) and sao (on vs off).. and I'm guessing tweeks related to sao?

Here are my commands and output for the 4GB/10.2Mbps file:

ffmpeg -i inputfile.mkv -filter_complex "[0:0]crop=3840:1604:0:278[v]" -map "[v]" -c:v libx265 -preset slow -crf 15.0 -x265-params aq-mode=4:aq-strength=1.10:strong-intra-smoothing=0:min-keyint=23:bframes=8:rc-lookahead=80:subme=5:rd=4:selective-sao=4:psy-rd=1.30:psy-rdoq=2.00:sar=1:videoformat=5:high-tier=1:repeat-headers=1:colorprim=9:transfer=16:colormatrix=9:chromaloc=1:hdr10=1:hdr10-opt=1:master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1):max-cll=0,0 -map 0:a:0 -c:a copy outputfile.mkv

frame=75854 fps=2.0 q=23.0 Lsize= 5333867kB time=00:52:43.74 bitrate=13811.2kbits/s speed=0.0853x
video:3918332kB audio:1412896kB subtitle:0kB other streams:0kB global headers:3kB muxing overhead: 0.049497%
x265 [info]: frame I: 639, Avg QP:16.77 kb/s: 26791.14
x265 [info]: frame P: 13728, Avg QP:17.91 kb/s: 22683.98
x265 [info]: frame B: 61487, Avg QP:21.27 kb/s: 7167.97
x265 [info]: Weighted P-Frames: Y:17.2% UV:13.1%

encoded 75854 frames in 37077.10s (2.05 fps), 10141.36 kb/s, Avg QP:20.63



Here are my commands and output for the 18.5GB/44.4Mbps file:

ffmpeg -i inputfile.zzz -filter_complex "[0:0]crop=3840:1604:0:278[v]" -map "[v]" -c:v libx265 -preset slow -crf 15.0 -x265-params sao=0:cutree=0:open-gop=0:aud=1:hrd=1:level-idc=5.1:high-tier=1:repeat-headers=1:colorprim=9:transfer=16:colormatrix=9:chromaloc=1:hdr10=1:hdr10-opt=1:master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1):max-cll=0,0 -map 0:a:0 -c:a copy outputfile.mkv

frame=75854 fps=1.9 q=5.0 Lsize=18567426kB time=00:52:43.74 bitrate=48077.3kbits/s speed=0.0801x
x265 [info]: frame I: 691, Avg QP:11.53 kb/s: 81822.25
x265 [info]: frame P: 17848, Avg QP:12.61 kb/s: 62840.03
x265 [info]: frame B: 57315, Avg QP:14.83 kb/s: 38211.71
x265 [info]: Weighted P-Frames: Y:17.8% UV:13.2%

encoded 75854 frames in 39487.49s (1.92 fps), 44403.89 kb/s, Avg QP:14.28


I know that bitrates don't necessarily match up for quality (subjective), but these files are VASTLY different in sizes. I'm just looking for insight from you all in helping understand the results. What does Avg QP mean? Where/how do you know if you're getting diminishing returns with higher bitrates?

Anyway, thanks again for reading.

excellentswordfight
27th August 2023, 22:31
Well, the command lines are not that similar, why dont you just use the same settings and change those and see? Anyway... The difference in bitrate between the output is probably not cause of SAO, as i rarely see it affect bitrate at given crf value. Its most likely due to these three: aq-mode=4:aq-strength=1.10:psy-rd=1.30, as all of them can have a big effect on bitrate at the same crf, just changing psy-rd can have drastic impacts depending on content.

Where/how do you know if you're getting diminishing returns with higher bitrates?
You use the same settings and increase the crf value in steps and see when there is a relevant (for you) decrease in quality.

Boulder
28th August 2023, 06:15
A huge difference is in cu-tree, which seems to be enabled in one encode and disabled in the other.