[FFmpeg-devel] Change libaom default to crf=32.

Submitted by elliottk on Aug. 21, 2019, 7:18 p.m.

Details

Message ID 20190821191820.50178-1-elliottk@google.com
State New
Headers show

Commit Message

elliottk Aug. 21, 2019, 7:18 p.m.
From: elliottk <elliottk@google.com>

Current default is 256kbps, which produces inconsistent
results (too high for low-res, too low for hi-res).
Use CRF instead, which will adapt.
---
 libavcodec/libaomenc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

James Zern Aug. 22, 2019, 1:03 a.m.
On Wed, Aug 21, 2019 at 12:18 PM Elliott Karpilovsky
<elliottk-at-google.com@ffmpeg.org> wrote:
>
> From: elliottk <elliottk@google.com>
>
> Current default is 256kbps, which produces inconsistent
> results (too high for low-res, too low for hi-res).
> Use CRF instead, which will adapt.
> ---
>  libavcodec/libaomenc.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>

lgtm. I'll apply this soon if there aren't any other comments. libvpx
could probably use a similar update.
Moritz Barsnick Aug. 22, 2019, 7:25 a.m.
On Wed, Aug 21, 2019 at 18:03:23 -0700, James Zern wrote:
> > From: elliottk <elliottk@google.com>
> > Current default is 256kbps, which produces inconsistent
> > results (too high for low-res, too low for hi-res).
> > Use CRF instead, which will adapt.
>
> lgtm. I'll apply this soon if there aren't any other comments. libvpx
> could probably use a similar update.

Is this a behavioral change which would justify a bump of libavcodec
micro?

Just wondering,
Moritz
James Zern Aug. 22, 2019, 4:42 p.m.
Hi,

On Thu, Aug 22, 2019 at 12:25 AM Moritz Barsnick <barsnick@gmx.net> wrote:
>
> On Wed, Aug 21, 2019 at 18:03:23 -0700, James Zern wrote:
> > > From: elliottk <elliottk@google.com>
> > > Current default is 256kbps, which produces inconsistent
> > > results (too high for low-res, too low for hi-res).
> > > Use CRF instead, which will adapt.
> >
> > lgtm. I'll apply this soon if there aren't any other comments. libvpx
> > could probably use a similar update.
>
> Is this a behavioral change which would justify a bump of libavcodec
> micro?
>

Yes I had that thought and had a bump locally. It is only a setting
change not the introduction of a new option, but I thought increasing
it would be safest.
James Zern Aug. 23, 2019, 6:11 p.m.
On Wed, Aug 21, 2019 at 6:03 PM James Zern <jzern@google.com> wrote:
>
> On Wed, Aug 21, 2019 at 12:18 PM Elliott Karpilovsky
> <elliottk-at-google.com@ffmpeg.org> wrote:
> >
> > From: elliottk <elliottk@google.com>
> >
> > Current default is 256kbps, which produces inconsistent
> > results (too high for low-res, too low for hi-res).
> > Use CRF instead, which will adapt.
> > ---
> >  libavcodec/libaomenc.c | 9 +++++----
> >  1 file changed, 5 insertions(+), 4 deletions(-)
> >
>
> lgtm. I'll apply this soon if there aren't any other comments. libvpx
> could probably use a similar update.

applied, thanks.

Patch hide | download patch | download mbox

diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 9b4fb3b4eb..7f47707a09 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -575,10 +575,11 @@  static av_cold int aom_init(AVCodecContext *avctx,
         if (enccfg.rc_end_usage == AOM_CQ) {
             enccfg.rc_target_bitrate = 1000000;
         } else {
-            avctx->bit_rate = enccfg.rc_target_bitrate * 1000;
+            enccfg.rc_end_usage = AOM_Q;
+            ctx->crf = 32;
             av_log(avctx, AV_LOG_WARNING,
-                   "Neither bitrate nor constrained quality specified, using default bitrate of %dkbit/sec\n",
-                   enccfg.rc_target_bitrate);
+                   "Neither bitrate nor constrained quality specified, using default CRF of %d\n",
+                   ctx->crf);
         }
     }
 
@@ -1091,7 +1092,7 @@  static const AVOption options[] = {
 };
 
 static const AVCodecDefault defaults[] = {
-    { "b",          "256*1000" },
+    { "b",                 "0" },
     { "qmin",             "-1" },
     { "qmax",             "-1" },
     { "g",                "-1" },