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

# Summary of changes

This PR allows output packets to scale on resolution.
Without this, FFmpeg uses -bufsize for each output buffer.

But AV1 or VP9 frame can be bigger than that. Now it has the same rule FFmpeg's 
VAAPI, D3D12 and Vulkan encoders use. (3 × width × height + 64 KB)

-bufsize is still kept as a floor.

<!--
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
```
-->



From ef2580fb5c2db3585dcd0bcacded33c6ec959136 Mon Sep 17 00:00:00 2001
From: ykisana <[email protected]>
Date: Sat, 10 Oct 2026 11:37:38 -0600
Subject: [PATCH] avcodec/qsvenc: scale output packets on resolution
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Allowing outpush packets to scale on resolution.
Without this, FFmpeg uses -bufsize for each output buffer.
But AV1 or VP9 frame can be bigger than that.
Now it has the same rule FFmpeg's VAAPI, D3D12 and Vulkan encoders use.
(3 × width × height + 64 KB)
bufsize is still kept as a floor.
---
 libavcodec/qsvenc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index c79db089a0..3d4a04b58d 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1844,6 +1844,10 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext 
*q)
         return ret;
     }
 
+    q->packet_size = FFMAX(q->packet_size,
+                           3 * q->param.mfx.FrameInfo.Width *
+                           q->param.mfx.FrameInfo.Height + (1 << 16));
+
     q->avctx = avctx;
 
     return 0;
-- 
2.52.0

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

Reply via email to