PR #24979 opened by ykisana
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24979
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24979.patch

# Summary of changes

<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).

Attached filenames must match the sample's filename:

```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->

Fixes #24965

Adding condition for VP9 so we only requesting MFX_FRAMETYPE_I

Without this change the VP9 Runtime downgrades FFmpeg's keyframe requests to a 
P frame and gives a warning (`incompatible video parameters (5)`).

This is because FFmpeg send a combination of flags (`I | REF`). Which make 
sense for  H.264 and HEVC accept that. But Intel's VP9 only takes `I`.

This is done here: 
https://github.com/intel/vpl-gpu-rt/blob/86000ef5e7348d4441b42fa59a3094ffeb6549ed/_studio/mfx_lib/encode_hw/vp9/src/mfx_vp9_encode_hw_par.cpp#L1853-L1857

REF: `0x40` which is larger than P: `0x02`. So now with this change we're only 
using I: `0x01` for VP9 only for key-frames.





>From 4e859c4ac8c2963dc105931eda8c803d3fdb8522 Mon Sep 17 00:00:00 2001
From: ykisana <[email protected]>
Date: Fri, 9 Oct 2026 15:41:49 -0600
Subject: [PATCH] libavcodec/qsvenc: Request MFX_FRAMETYPE_I only for VP9

---
 libavcodec/qsvenc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index c79db089a0..2af0608cc1 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -2483,9 +2483,13 @@ static int encode_frame(AVCodecContext *avctx, 
QSVEncContext *q,
         enc_ctrl = &qsv_frame->enc_ctrl;
 
         if (frame->pict_type == AV_PICTURE_TYPE_I) {
-            enc_ctrl->FrameType = MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF;
-            if ((frame->flags & AV_FRAME_FLAG_KEY) || q->forced_idr)
-                enc_ctrl->FrameType |= MFX_FRAMETYPE_IDR;
+            if (avctx->codec_id == AV_CODEC_ID_VP9) {
+                enc_ctrl->FrameType = MFX_FRAMETYPE_I;
+            } else {
+                enc_ctrl->FrameType = MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF;
+                if ((frame->flags & AV_FRAME_FLAG_KEY) || q->forced_idr)
+                    enc_ctrl->FrameType |= MFX_FRAMETYPE_IDR;
+            }
         }
     }
 
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to