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 1b1f602699 avcodec/d3d12va_encode: set extradata for global header 
when muxing AV1 to MKV
1b1f602699 is described below

commit 1b1f6026990bd081ec6e2cef8cd88f60ddbfea66
Author:     younengxiao <[email protected]>
AuthorDate: Wed Jun 24 13:40:02 2026 -0400
Commit:     Tong Wu <[email protected]>
CommitDate: Wed Jul 22 03:18:18 2026 +0000

    avcodec/d3d12va_encode: set extradata for global header when muxing AV1 to 
MKV
    
    When the muxer sets AV_CODEC_FLAG_GLOBAL_HEADER (as MKV does), the codec
    must populate avctx->extradata with the sequence header so the muxer can
    write the av1C codec private entry. Otherwise, the mkv muxer will return
    AVERROR_INVALIDDATA on the first packet (Invalid data found when
    processing input).
    
    Example usage:
      # use mkv container:
      ffmpeg -hwaccel d3d12va -hwaccel_output_format d3d12 -i input.mp4 -c:v 
av1_d3d12va output.mkv
    
    Signed-off-by: younengxiao <[email protected]>
---
 libavcodec/d3d12va_encode.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/libavcodec/d3d12va_encode.c b/libavcodec/d3d12va_encode.c
index d7125db929..442dbc6a4a 100644
--- a/libavcodec/d3d12va_encode.c
+++ b/libavcodec/d3d12va_encode.c
@@ -1858,6 +1858,27 @@ int ff_d3d12va_encode_init(AVCodecContext *avctx)
     if (!base_ctx->encode_fifo)
         return AVERROR(ENOMEM);
 
+    if (ctx->codec->write_sequence_header &&
+        avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
+        char header_data[MAX_PARAM_BUFFER_SIZE];
+        size_t header_bit_len = 8 * sizeof(header_data);
+
+        err = ctx->codec->write_sequence_header(avctx, header_data, 
&header_bit_len);
+        if (err < 0) {
+            av_log(avctx, AV_LOG_ERROR, "Failed to write sequence header "
+                   "for global header: %d.\n", err);
+            goto fail;
+        }
+        avctx->extradata_size = (int)((header_bit_len + 7) / 8);
+        avctx->extradata = av_mallocz(avctx->extradata_size +
+                                      AV_INPUT_BUFFER_PADDING_SIZE);
+        if (!avctx->extradata) {
+            err = AVERROR(ENOMEM);
+            goto fail;
+        }
+        memcpy(avctx->extradata, header_data, avctx->extradata_size);
+    }
+
     return 0;
 
 fail:

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

Reply via email to