Confusion over zones, qpfile and qpmax due to much different behavior

Issue #587 new
Stacey Spears created an issue

Either the docs need to be clarified or something is not working correctly with zones, qpfile and qpmax.

Here are examples of all three, plus batch and source YUV file to repro: https://www.dropbox.com/s/l1c6tgqdnimuhxn/qp_test.7z?dl=1

Here is a line from the 2 pass encode statsfile just to get a baseline. No zones, qpfile or qpmax used. Just rate control set high. (89/98 Mbps)

n:0 out:0 type:I q:16.69 q-aq:22.84 q-noVbv:16.69 q-Rceq:937.97 tex:10058863 mv:31137 misc:20321 icu:32400.00 pcu:0.00 scu:0.00 sc:0 ;

There is q, q-aq and q-noVbv. Perhaps you can start by explaining the difference between the three and clarify which one is actually the frame QP.

1: I thought / assumed that ‘q' is the actual frame QP and that ‘q-aq” is the adaptive quant QP. However, in the CSV files, 'q-aq’ is the QP value written and not 'q’. So understanding all three would be helpful.

2: If I use a zones to set the QP. It seems more like a delta QP as that values is used for ‘q-noVbv’ and then it alters the other two. Here is the line when I use --zones 0,1,q=5 (also, I have to set the out at least one frame ahead vs. 0,0)

in:0 out:0 type:I q:10.51 q-aq:16.72 q-noVbv:5.00 q-Rceq:937.97 tex:14794731 mv:48850 misc:22282 icu:32400.00 pcu:0.00 scu:0.00 sc:0 ;

3: If I use qpfile to set the frame to QP 5, I get different results from zones. ‘q-noVbv’ is set to 5 like zones, but ‘q' and 'q-aq’ are much different than using zones.

in:0 out:0 type:I q:5.45 q-aq:11.95 q-noVbv:5.00 q-Rceq:937.97 tex:19092315 mv:50776 misc:11786 icu:32400.00 pcu:0.00 scu:0.00 sc:0 ;

4: If I use qpmax to set the frame qp to 5, I get exactly what I expect to happen.

in:0 out:0 type:I q:5.00 q-aq:4.94 q-noVbv:5.00 q-Rceq:937.97 tex:28344003 mv:85635 misc:19552 icu:32400.00 pcu:0.00 scu:0.00 sc:0 ;

What should qpfile or zones be doing? Is this the correct behavior? I am trying to fix the key frame popping I have in certain scenes by lower the QP of the I-frames. In my scenario I am using a two pass VBV and this is for Ultra HD Blu-ray.

It would be nice if I could use qpmax in a zonefile, but that is not a valid option.

I have included everything from all four encodes (default, zones, qpmax and qpfile). This includes 1st and 2nd pass csv files, the statsfile, my bat files, a YUV file, etc…)

Comments (2)

  1. Ben Waggoner

    Those are some interesting bugs. You’re using some unusual combinations of parameters that likely have exposed some defects.

    Keyframe popping may be better addressed with using --hist-scenecut and especially --scenecut-aware-qp. 3.5 also has some VBV rate control fixes that might address your scenario.

  2. Stacey Spears reporter

    Tried it, does not help. It is a shame that p and b delta is not honored. On the shot that has the pulsing, I frames end up in the 20s and p and b are much lower.

    Setting qp step size to 1 helped reduce pulsing in other shots. Main Concept does not have this issue at all, but does not enforce BD constraints in Transkoder either, so can’t use it.

  3. Log in to comment