View Full Version : ipratio/pbratio for very high bitrates
andiandi
6th July 2022, 17:23
Hi,
I would like to make a preset for a "visually lossless" quality (or almost) for archive purposes and to keep well preserved sources if I have to re-encode for whatever reason (editing...).
I'm aiming for "DVD-like" bitrates for SD (5000-9000 Kbps) mainly for my VHS project, and higher bitrates for 720p sources (15-20 Mbps).
I did some tests (with 3 bframes + no-mbtree) by keeping ipratio and pbratio defaults values and by lowering them, and each case seem to have its pros and cons so I can't decide what to choose. I don't really like playing with Quantizers-related settings (most of time, the result wasn't really satisfying to me) and I want to make sure I do things right since I'll get rid of the lossless material.
So I'm wondering :
- Could lowering pbratio to 1.1 in this context cause some issues ? (Maybe it's for good reason that no preset/tune lowers ipratio only or pbratio only.).
- Is it a good thing to use ipratio 1.1 + pbratio 1.1 (like in grain tune) for these bitrates ranges (or at least better than using 0 b-frames ?)
Any other advices that can help are welcome
Thank you
Emulgator
6th July 2022, 23:15
- Is it a good thing to use ipratio 1.1 + pbratio 1.1 (like in grain tune) for these bitrates ranges (or at least better than using 0 b-frames ?)
I am aiming at the same bitrates for the same occasion,
use close to that (ipratio 1.2, pbratio 1.1) all the time in my presets and limit qpmax to 48
and I can recommend that for your case.
andiandi
7th July 2022, 15:26
I am aiming at the same bitrates for the same occasion,
use close to that (ipratio 1.2, pbratio 1.1) all the time in my presets and limit qpmax to 48
and I can recommend that for your case.
Thanks,
Seems good to me, because according to my tests, ipratio 1.1 + pbratio 1.1 quality seems a bit insufficient and for defaults ipratio & pbratio values, there's still often a slight blur. As for qpmax 48, is it that useful ? IIRC default qpmax was changed because of mbtree, but is qpmax 51 (the older default value) alright for these bitrates as well ? (I'm wondering because 48 and 51 are close).
Emulgator
7th July 2022, 22:37
It is your choice. I was just aiming for best Blu-ray quality at blu-ray bitrates.
So I just decided not to allow too much quantization because of water, leaves, hair and such.
You may decide any limiting qp value depending on what bitrate overshoot your playback device can handle.
You may consider limiting gpmax below 40 if more quality is your goal, and not go for bitrate.
(Lowering ipratio, pbratio helps in reducing GOP pumping, not necessarily against blur.
If you encounter blur it may be quantization artifacts already and you just limit that by lowering qpmax see above.
Lowering qpmax just lets encoder spend more bits where hard-to compress content needs it, not looking at bitrate.
while allowing high qpmax allows butchering to stay in bitrate constraints,
and 51 is already too high for me, and 69 is insanely poor,
and I considered 48 good enough while not pushing bitrate too high.
For a mezzanine you may set qpmax far below.)
andiandi
8th July 2022, 16:19
It is your choice. I was just aiming for best Blu-ray quality at blu-ray bitrates.
So I just decided not to allow too much quantization because of water, leaves, hair and such.
You may decide any limiting qp value depending on what bitrate overshoot your playback device can handle.
You may consider limiting gpmax below 40 if more quality is your goal, and not go for bitrate.
(Lowering ipratio, pbratio helps in reducing GOP pumping, not necessarily against blur.
If you encounter blur it may be quantization artifacts already and you just limit that by lowering qpmax see above.
Lowering qpmax just lets encoder spend more bits where hard-to compress content needs it, not looking at bitrate.
while allowing high qpmax allows butchering to stay in bitrate constraints,
and 51 is already too high for me, and 69 is insanely poor,
and I considered 48 good enough while not pushing bitrate too high.
For a mezzanine you may set qpmax far below.)
Ok, it's very interesting because the only thing that bothers me a bit is this slight blur with default ipratio and pbratio values. So if i can compensate this with qpmax I could stick to default values since I prefer their result overall if exclude the blur.
However, I'll possibly have to change ipratio & pbratio since I'd like to lower keyint to make lossless cutting easier, just in case (I don't plan to lower it that much - maybe 1 keyframe each 2/2.5 seconds ideally, or 5 seconds). So in this context, I'm wondering if it could cause that "GOP pumping" ? (It's when the visual quality variation between frames become too much noticeable when keyframes are very close, right ?).
Also, I would be interested to know if they're other settings that could reduce this slight blur while suiting these bitrates at the same time ? (I thought about lowering Aq-strengh but from several tests I did, I'm not really convinced so far).
Boulder
12th July 2022, 13:55
You could try disabling mbtree to see if it helps with the blurring.
andiandi
12th July 2022, 15:59
You could try disabling mbtree to see if it helps with the blurring.
Yes, I disabled it, I lowered aq-strenght to 0.5 as well and it helps a lot. The blur is almost entirely gone. However, I'm very careful about how it looks since I want to make potential sources for re-encoding. So I'm still hesitating between :
- "Aq-strength 0.5 + lowering ipratio & pbratio + qcomp 0.8" (very homogeneous quality even though it seems slightly insufficient even at these bitrates; it's particularly noticeable on colors and since I want to encode in 4:2:2 Chroma subsampling I think compression is quite important).
- "Aq-strength 0.5 + default ipratio & pbratio" (almost no blur at all and very satisfying quality, but i'm not sure if quality could vary much or not and if "gop pumping" could be noticeable at these bitrates - especially if i lower keyint).
benwaggoner
12th July 2022, 19:17
Yes, I disabled it, I lowered aq-strenght to 0.5 as well and it helps a lot. The blur is almost entirely gone. However, I'm very careful about how it looks since I want to make potential sources for re-encoding. So I'm still hesitating between :
- "Aq-strength 0.5 + lowering ipratio & pbratio + qcomp 0.8" (very homogeneous quality even though it seems slightly insufficient even at these bitrates; it's particularly noticeable on colors and since I want to encode in 4:2:2 Chroma subsampling I think compression is quite important).
- "Aq-strength 0.5 + default ipratio & pbratio" (almost no blur at all and very satisfying quality, but i'm not sure if quality could vary much or not and if "gop pumping" could be noticeable at these bitrates - especially if i lower keyint).
frame strobing (aka "gop pumping" which I think is a confusing name) can be detected somewhat well by comparing SSIM values between I, P, and B frames (--ssim, --csv-log-level 2). There should be very little variation when there isn't any strobing.
If you are having chroma issues, you could lower both chroma qp values to -1. It'll bump bitrate a bit, of course.
andiandi
12th July 2022, 21:57
frame strobing (aka "gop pumping" which I think is a confusing name) can be detected somewhat well by comparing SSIM values between I, P, and B frames (--ssim, --csv-log-level 2). There should be very little variation when there isn't any strobing.
If you are having chroma issues, you could lower both chroma qp values to -1. It'll bump bitrate a bit, of course.
Ok, thank you.
I tried but --csv-log-level 2 isn't working with x264, it appears to be an x265 option.
benwaggoner
13th July 2022, 03:52
Ok, thank you.
I tried but --csv-log-level 2 isn't working with x264, it appears to be an x265 option.
Oh, right. I keep forgetting which is which as x264 hasn't gotten new parameters in a long time. I'd love to see the csv logging patch make it into mainline. IIRC, MCW contributed it to x264 many years back.
andiandi
13th July 2022, 19:35
Oh, right. I keep forgetting which is which as x264 hasn't gotten new parameters in a long time. I'd love to see the csv logging patch make it into mainline. IIRC, MCW contributed it to x264 many years back.
Regarding this SSIM values test (supposing it could be done) I wonder if the result could be generalized to most videos at these bitrates (in theory) or if it only concerns the tested video ? Because I prefer having a preset I re-use in any case without having to check that frame strobbing/GOP Pumping.
Otherwise, I think it'd be better to improve the preset with lowered ipratio & pbratio (I still can't decide but colors are better preserved using Qcomp 0.6 or a bit more instead of 0.8 - which seems to hurt much compression in this context).
Emulgator
14th July 2022, 17:20
If comparing more than 2..3 parameters Zopti is your friend.
https://forum.doom9.org/showthread.php?t=176076
benwaggoner
15th July 2022, 01:01
Regarding this SSIM values test (supposing it could be done) I wonder if the result could be generalized to most videos at these bitrates (in theory) or if it only concerns the tested video ?
It's a generalized recommendation.
Ugh, the lack of per-frame .csv logging in x264 mainline is such a drudge. It's a very powerful tuning and QA tool with x265.
andiandi
15th July 2022, 16:11
If comparing more than 2..3 parameters Zopti is your friend.
https://forum.doom9.org/showthread.php?t=176076
Interesting, I'll look it up, thanks.
It's a generalized recommendation.
Ugh, the lack of per-frame .csv logging in x264 mainline is such a drudge. It's a very powerful tuning and QA tool with x265.
Ok, it should help me choose which preset I'll keep if I can make both presets closer between them.
If there're other settings that could help even more in this case (without really hurting compression) please let me know, thanks.
takla
17th July 2022, 01:12
Or you can use this to compare (https://github.com/fifonik/FFMetrics)
andiandi
17th July 2022, 17:49
Or you can use this to compare (https://github.com/fifonik/FFMetrics)
Thanks, now I'm pretty sure to prefer the preset that has ipratio and pbratio lowered + aq-strenght 0.5 (which I'm still trying to perfect a bit even though it's already satisfying), but this program interests me much, thanks again :)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.