Opened 9 years ago

Closed 8 years ago

#3238 closed enhancement (fixed)

QScale does not work with libx264

Reported by: ramitb Owned by:
Priority: wish Component: avcodec
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:
The scale parameter does not work with libx264 codec. No matter what the value is it always has the same quality/size output.

Change History (8)

comment:1 by Nicolas George, 9 years ago

That is normal. See The option to encode at constant quantizer is -qp.

comment:2 by ramitb, 9 years ago

since ffmpeg provides -qscale as a generic codec agnostic option (I know each codec may interpret the value differently) so wouldn't itmake sense to internally map -qscale to -qp or -crf?

comment:3 by Michael Niedermayer, 8 years ago

it would make sense but there are 2 ways to do it, one is just use the numeric value as is the other is to remap the values so the quatization used is similar. Both variants will probably confuse some people, so iam unusure about what to do here

comment:4 by llogan, 8 years ago

Another option is an info message describing the current, sane rate control behavior:

-qscale is ignored with libx264. Use -crf instead. Default of -crf 23 will be used.

comment:5 by ramitb, 8 years ago

Preserving user intent should be paramount. So keeping that in mind it would make sense to translate the values into appropriate crf values.

comment:6 by llogan, 8 years ago

Priority: normalwish
Type: defectenhancement
Version: unspecifiedgit-master

That will increase confusion:

  • -qscale traditionally means constant quantizer, but 99% of users should not be using -qp.
  • Users have always been told to ignore -qscale with libx264:

    <Dark_Shikari> don't use qscale with libx264, ever

  • Many users will assume the linear "mpeg" quant scale of 1-31 since -qscale is most often associated with this type of encoder.
  • I believe user intent is being preserved with the current behavior. What is the actual user intent? Most users want -crf even if they do not actually know what they want. Adding an alias that means something else in other encoders is confusing.

I think the info message is the best option and will not change current behavior which I think is a very important consideration.

comment:7 by ramitb, 8 years ago

So here's an interesting thought a user who's using qscale is essentially asking for the equuivalent for it for libx264, so the intent is mapping to crf. So put a message that qscale is not appropriate and one should use crf instead but internally map it to crf rather than throwing an error. As a user I would like the usage to be as simple as possible. Generally IMHO failing is never a good sign for any software (where possible).

comment:8 by llogan, 8 years ago

Component: undeterminedavcodec
Resolution: fixed
Status: newclosed

Addressed by James Darnley in f028329:

commit f02832904dbce8e0473cdc9c7b09d92493b40a14
Author: James Darnley
Date:   Sat Mar 22 09:48:52 2014 +0100

    lavc/libx264: add a warning when using qscale
    This addresses ticket #3238.
    Signed-off-by: Michael Niedermayer <>
Note: See TracTickets for help on using tickets.