This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 46560047e9 fftools/ffmpeg_mux_init: fix -global_quality being lost
46560047e9 is described below

commit 46560047e91c5d2ce3905f9a7239b261c06047a3
Author:     nyanmisaka <[email protected]>
AuthorDate: Wed Sep 23 14:35:09 2026 +0800
Commit:     James Almer <[email protected]>
CommitDate: Wed Oct 7 13:02:40 2026 +0000

    fftools/ffmpeg_mux_init: fix -global_quality being lost
    
    The `global_quality` is not stored in `Encoder` when `qscale` is not set.
    Some encoders rely on it to switch the rate control mode from CQP to ICQ.
    
    ```
    ffmpeg -v verbose -f lavfi -i nullsrc=s=1920x1080,format=nv12 \
    -c:v h264_qsv -global_quality 20 -t 1 -f null -
    ...
    [h264_qsv @ 00000234c99847c0] Using the constant quantization parameter 
(CQP) by default.
    Please use the global_quality option and other options for a quality-based 
mode or the b option
    and other options for a bitrate-based mode if the default is not the 
desired choice.
    
    [h264_qsv @ 00000234c99847c0] Using the constant quantization parameter 
(CQP) ratecontrol method
    ```
    
    Fixes 7d905abec6ab565ac3afbaa7840ed278a330eab2
    
    Signed-off-by: nyanmisaka <[email protected]>
---
 fftools/ffmpeg_mux_init.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index aef27e2a8f..fb8e19deef 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -1563,9 +1563,12 @@ static int ost_add(Muxer *mux, const OptionsContext *o, 
enum AVMediaType type,
     }
 
     opt_match_per_stream_dbl(ost, &o->qscale, oc, st, &qscale);
-    if (ost->enc && qscale >= 0) {
-        ost->enc->flags          |= AV_CODEC_FLAG_QSCALE;
-        ost->enc->global_quality  = FF_QP2LAMBDA * qscale;
+    if (ost->enc) {
+        if (qscale >= 0) {
+            ost->enc->flags          |= AV_CODEC_FLAG_QSCALE;
+            ost->enc->global_quality  = FF_QP2LAMBDA * qscale;
+        } else
+            ost->enc->global_quality  = ost->enc->enc_ctx->global_quality;
     }
 
     if (ms->sch_idx >= 0) {

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to