Opened 6 years ago

Closed 5 years ago

#3238 closed enhancement (fixed)

QScale does not work with libx264

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

Description

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 Changed 6 years ago by Cigaes

That is normal. See http://ffmpeg.org/ffmpeg-codecs.html#Options-10. The option to encode at constant quantizer is -qp.

comment:2 Changed 6 years ago by ramitbhalla

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 Changed 5 years ago by michael

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 Changed 5 years ago by llogan

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 Changed 5 years ago by ramitbhalla

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 Changed 5 years ago by llogan

  • Priority changed from normal to wish
  • Type changed from defect to enhancement
  • Version changed from unspecified to git-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 Changed 5 years ago by ramitbhalla

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 Changed 5 years ago by llogan

  • Component changed from undetermined to avcodec
  • Resolution set to fixed
  • Status changed from new to closed

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 <michaelni@gmx.at>
Note: See TracTickets for help on using tickets.