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. |
22nd October 2008, 13:38 | #1 | Link |
Registered User
Join Date: Feb 2007
Location: Athens, Greece
Posts: 43
|
x264: qp2bitrate, bit2qp ?
If I encode a two pass encode, using a given bitrate A and the x264 log reports an achieved mean QP B, is some kind of function that will give me the estimated QP B' if I reencode (using the same video and parameters of course) using a bitrate A'
is the opposite also predictable ? I mean if I want to achieve a QP B' what is the bitrate A' that I should give to x264 ? I searched the x264 source code and I did find in the ratecontrol.c some functions (qscale2bits,qp2qscale) but I am not sure that I am in the correct path, I suspect that I need to read and reevaluate each frame from the .stats file |
22nd October 2008, 15:37 | #2 | Link |
x264aholic
Join Date: Jul 2007
Location: New York
Posts: 1,752
|
The simple fact is you can't determine how many bits will be given for a certain QP and the number of bits to achieve a certain QP.
What happens when you have a completely flat frame, i.e. one color? It could have a QP of 0 and take up almost no bits. On the other hand, you can have a scene from parkrun that has a QP of 20 but takes up tons of bits.
__________________
You can't call your encoding speed slow until you start measuring in seconds per frame. |
22nd October 2008, 15:59 | #3 | Link |
x264 developer
Join Date: Sep 2004
Posts: 2,392
|
Bitrate is approximately proportional to 2^(-qp/6)
Yes you'll get a slightly more accurate estimate if you run qscale2bits on each frame, which scales mvs and residuals by different amounts. But if you want a target quality, use CRF and not 2pass. |
22nd October 2008, 16:40 | #4 | Link | ||
Registered User
Join Date: Feb 2007
Location: Athens, Greece
Posts: 43
|
Quote:
Quote:
about CRF specially if you use AQ or psy is not very accurate. The final QP varies several units on different videos I encoded with the same CRF value. |
||
22nd October 2008, 17:21 | #6 | Link |
Registered User
Join Date: Feb 2007
Location: Athens, Greece
Posts: 43
|
I do want constant quality but also I do not trust so much the CRF mode with AQ and psy.
Also QP is the only number that x264 reports (in the log), so I was wondering if I could predict it. If it had an average RF value (quality factor) I could use that, but it is not available Unless you implying I should use SSIM instead of QP, but again SSIM also varies on different videos encoded with the same CRF. |
22nd October 2008, 18:03 | #8 | Link | |
Registered User
Join Date: Feb 2007
Location: Athens, Greece
Posts: 43
|
Quote:
if the result of an encode doesn't match on what I observe as transparent, I want a factor than I can increase or decrease and Bitrate and QP are the only numbers I have. I was wondering if there was a formula where altering one I could predict the other |
|
22nd October 2008, 18:06 | #9 | Link | |
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
Quote:
|
|
22nd October 2008, 21:17 | #10 | Link |
x264aholic
Join Date: Jul 2007
Location: New York
Posts: 1,752
|
ncahammer, if you do several encodes to find the highest CRF that'll produce "transparent" quality for you, you can rest assured you can reuse that CRF over many encodes and the quality will be very similar.
Generally speaking, CRF 18 should produce transparency in almost every condition (I've yet to encounter a situation where it hasn't..)
__________________
You can't call your encoding speed slow until you start measuring in seconds per frame. |
Tags |
bitrate, x264 |
|
|