Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th July 2020, 11:43   #1  |  Link
Navetek
Registered User
 
Join Date: Feb 2020
Posts: 3
Need explanation on q and b parameter for "zones".

Here is the scenario: I've never before used "zones" to do any encoding, but today came across a source which I found necessary to be implemented with "zones".

So I read the documentation, and am confused with the b and q parameters. The original explanation reads:

"b=<float> applies a bitrate multiplier on the zone. Useful for extra tweaking of high- and low-action scenes.
q=<int> applies a constant quantizer on the zone. Useful for applying to a range of frames."

My questions are:

For q:
1. Does this mean that the encoder runs "Constant Quantizer" encoding mode with the q value you specified on this certain part of clip?
2. If so, why "constant quantizer" anyway, since I don't think people would use this mode ?
3. I could not find "crf" parameter available in the zones settingshttp://www.chaneru.com/Roku/HLS/X264_Settings.htm#zones, but I believe people used to set crf in zones. Why remove it?

For b:
4. Can anyone explain in detail how the "b" parameter actually works, since it is a little vague in the documentation. To be exact, how does it work in "automated 2 pass" and "constant quality" mode if there is a difference in the mechanism?

Many thanks!
Navetek is offline   Reply With Quote
Old 21st July 2020, 09:44   #2  |  Link
Greenhorn
Registered User
 
Join Date: Apr 2018
Posts: 52
Quote:
Originally Posted by Navetek View Post
Here is the scenario: I've never before used "zones" to do any encoding, but today came across a source which I found necessary to be implemented with "zones".

So I read the documentation, and am confused with the b and q parameters. The original explanation reads:

"b=<float> applies a bitrate multiplier on the zone. Useful for extra tweaking of high- and low-action scenes.
q=<int> applies a constant quantizer on the zone. Useful for applying to a range of frames."

My questions are:

For q:
1. Does this mean that the encoder runs "Constant Quantizer" encoding mode with the q value you specified on this certain part of clip?
2. If so, why "constant quantizer" anyway, since I don't think people would use this mode ?
3. I could not find "crf" parameter available in the zones settingshttp://www.chaneru.com/Roku/HLS/X264_Settings.htm#zones, but I believe people used to set crf in zones. Why remove it?

For b:
4. Can anyone explain in detail how the "b" parameter actually works, since it is a little vague in the documentation. To be exact, how does it work in "automated 2 pass" and "constant quality" mode if there is a difference in the mechanism?

Many thanks!
-b:

Broadly: it alters the bitrate of the zone, after stuff like CRF and AQ has been applied. It accepts values larger than zero, with values less than one reducing bitrate and values greater than one increasing it. A value of 2 will increase bitrate by more like 2.5x.
In CRF mode, the -b you set for an individual zone won't affect others. In ABR (2-pass) mode, it will-- your average bitrate for the file will still be equal to whatever your set, so bits will be redistributed between zones based on your -b settings. (How this plays out with more than a couple of zones is going to be more complicated than I can solve right now, sorry.)
It also works in constant quantizer mode, but you really don't want to use that anyway, no.

More technically, it lowers the quantizer of frames within the zone by 6*log2(b). 2=6, 0.5=-6 and a bitrate decrease, etc. (Google and Bing will calculate logs like that just by typing them in.) I'm really not good enough at explaining things to provide the necessary context for that if you need it, sorry.

As a source for the second part: look at line 1615 of (https://github.com/ShiftMediaProject.../ratecontrol.c). The official x264 repository at code.videolan.org won't load for me right now; that one seems up to date enough.

Regarding --crf being removed with zones; as I understand it based on Dark_Shikari's (the original? x264 maintainer's) document on rate control in x264, setting --crf to a given value sets all frames to have a quantizer of that value (like in constant quantizer mode), but then scales the value you've given according to the amount of motion in the frame. So altering the quantizer directly is pretty close to altering CRF values in the end.

Last edited by Greenhorn; 21st July 2020 at 09:58.
Greenhorn is offline   Reply With Quote
Old 21st July 2020, 14:03   #3  |  Link
Navetek
Registered User
 
Join Date: Feb 2020
Posts: 3
Quote:
Originally Posted by Greenhorn View Post
-b:

Broadly: it alters the bitrate of the zone, after stuff like CRF and AQ has been applied. It accepts values larger than zero, with values less than one reducing bitrate and values greater than one increasing it. A value of 2 will increase bitrate by more like 2.5x.
In CRF mode, the -b you set for an individual zone won't affect others. In ABR (2-pass) mode, it will-- your average bitrate for the file will still be equal to whatever your set, so bits will be redistributed between zones based on your -b settings. (How this plays out with more than a couple of zones is going to be more complicated than I can solve right now, sorry.)
It also works in constant quantizer mode, but you really don't want to use that anyway, no.

More technically, it lowers the quantizer of frames within the zone by 6*log2(b). 2=6, 0.5=-6 and a bitrate decrease, etc. (Google and Bing will calculate logs like that just by typing them in.) I'm really not good enough at explaining things to provide the necessary context for that if you need it, sorry.

As a source for the second part: look at line 1615 of (https://github.com/ShiftMediaProject.../ratecontrol.c). The official x264 repository at code.videolan.org won't load for me right now; that one seems up to date enough.

Regarding --crf being removed with zones; as I understand it based on Dark_Shikari's (the original? x264 maintainer's) document on rate control in x264, setting --crf to a given value sets all frames to have a quantizer of that value (like in constant quantizer mode), but then scales the value you've given according to the amount of motion in the frame. So altering the quantizer directly is pretty close to altering CRF values in the end.
Thank you very much!
Navetek is offline   Reply With Quote
Reply

Tags
zones

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 20:07.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.