Hi!

Attached patch fixes lossless aom encoding in some cases for me, it is
still possible to force lossy encoding with crf == 0 and qmax > 0.

Please comment, Carl Eugen
From a7b9b60d7091bbf0af84b8eda8bc84ce858d071e Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffm...@gmail.com>
Date: Sat, 20 Mar 2021 18:47:52 +0100
Subject: [PATCH] lavc/aom: Force default qmax to 0 if crf was set to 0.

Fixes lossless encoding.
---
 libavcodec/libaomenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 2c3c3eb185..a8f0420230 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -640,6 +640,8 @@ static av_cold int aom_init(AVCodecContext *avctx,
         if (!avctx->bit_rate)
             enccfg.rc_end_usage = AOM_Q;
     }
+    if (!ctx->crf && avctx->qmax == -1)
+        avctx->qmax = 0;
 
     if (avctx->bit_rate) {
         enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000,
-- 
2.30.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to