View Full Version : --qpfile usage
CAFxX
3rd April 2008, 15:43
For a university project I need to be able to specify the frame type for all coded frames. The --qpfile option in x264 looks like should do, but I have a few problems.
If I try to specify only the qpfile, it complains that I did not specify a rate control method.
What's the correct way, then, to invoke x264 so that it respects the contents of the qpfile?
J_Darnley
3rd April 2008, 23:30
Add a rate control method? Try qp 51 then you know if it hasn't obeyed the qpfile. Granted x264 shouldn't need a rate control method if you specify for every frame the type and quantiser in the file.
Dark Shikari
3rd April 2008, 23:33
x264 requires a ratecontrol method even if that method is intended to be completely overridden by --qpfile.
CAFxX
4th April 2008, 06:19
The problem is that if I specify any rate control method different from -q 0 or --crf 0 it doesn't obey at the qps I specified in the qpfile (it does respect the frame types, though).
For example, if I set --crf 1 all qp are raised by 3~3.5. If I specify any -q between 0 (exclusive) and 4, all qp are raised by exactly 4.
I'd go with -q 0 or --crf 0, but VLC outputs garbage when playing back (is it x264's fault or VLC's?)
p.s. using r807 here
Dark Shikari
4th April 2008, 06:32
I'd go with -q 0 or --crf 0, but VLC outputs garbage when playing back (is it x264's fault or VLC's?)This is because --qp 0 enables lossless mode, but the QPfile results in non-lossless QPs being used. "Lossless mode" actually sets a bit in the header that says "QP 0 is lossless." As a result, if a non-zero QP is used, the decoder will consider it non-lossless, even if it was coded as such.
CAFxX
4th April 2008, 19:11
Ok, fine. But if those two switches are the only ones that make x264 respect the QPs specified in the qpfile BUT at the same time they make the output unplayable, what switches am I supposed to pass to x264 to have it respect the QPs AND have a playable output file?
foxyshadis
4th April 2008, 20:14
Use a bitrate instead?
CAFxX
4th April 2008, 22:36
Nope. I need to be able to specify, for each frame, its type (intra, inter, b, etc.) and its qp. This is for a research project, so I really need this and not something else. Am I the only one that finds it odd that --qpfile does not disable rate control altogether?
Another (semi) correlated question: is x264 capable of hierarchical coding (in the JM sense), or at least is it possible to tell it in which order to encode the frames (I'm not talking about display order but about encoding order)?
CAFxX
4th April 2008, 22:38
This is because --qp 0 enables lossless mode, but the QPfile results in non-lossless QPs being used. "Lossless mode" actually sets a bit in the header that says "QP 0 is lossless." As a result, if a non-zero QP is used, the decoder will consider it non-lossless, even if it was coded as such.
Then this may be a bug, since x264 with -q 0 and --qpfile at the end of the encoding reports that the avg qp are those I specified in the qpfile.
foxyshadis
6th April 2008, 01:18
I meant, use a bitrate as a rate control method to keep x264 happy, which would then be overriden by the qp file.
Yes, it is screwy to me though.
akupenguin
6th April 2008, 01:25
-q 1. or any other value besides 0.
Yes there's a bug in that it allows you to override qp after selecting lossless, but if I fixed that it still wouldn't do what you want, it would just force lossless.
I can't allow no ratecontrol method, because qpfile is an x264cli option, not a libx264 option, and libx264 can't know in advance that you will override every frame. Delaying the error from init time to the first frame that's not overridden would make some frontends like mencoder less happy.
CAFxX
6th April 2008, 11:17
-q 1. or any other value besides 0.
This forces all QPs to 4...
Using --crf 1 or -B 10000 (random values) it does not really respect the specified QPs... In my qpfile all I, P, B frames have - respectively - the same QP_I, QP_P and QP_B. But x264 at the end of the encode reports average QPs skewed by +3~+4 (the video is the football CIF sequence).
Dark Shikari
6th April 2008, 11:18
This forces all QPs to 4...
Using --crf 1 or -B 10000 (random values) it does not really respect the specified QPs... In my qpfile all I, P, B frames have - respectively - the same QP_I, QP_P and QP_B. But x264 at the end of the encode reports average QPs skewed by +3~+4 (the video is the football CIF sequence).This is probably because AQ is enabled ;)
It still is using (correctly) the QPs from your QPfile for the frame QPs.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.