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 140d708d65 avcodec/codec_par: copy AVCodecContext sw_pix_fmt instead 
of pix_fmt to AVCodecParameters if set
140d708d65 is described below

commit 140d708d65f65dbfb10ee44d87964c66554f4373
Author:     James Almer <[email protected]>
AuthorDate: Wed Jun 10 14:06:25 2026 -0300
Commit:     James Almer <[email protected]>
CommitDate: Tue Jun 16 10:11:32 2026 -0300

    avcodec/codec_par: copy AVCodecContext sw_pix_fmt instead of pix_fmt to 
AVCodecParameters if set
    
    In case of an encoding scenario using a hardware encoder, 
AVCodecContext->pix_fmt may be a
    hwaccel format that conveys no information muxers can use when looking at 
its descriptor,
    as is the case of bitdepth.
    As such, if sw_pix_fmt is set, copy that value instead.
    
    Fixes issue #23420
    
    Signed-off-by: James Almer <[email protected]>
---
 libavcodec/codec_par.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/codec_par.c b/libavcodec/codec_par.c
index ddf349ceea..d8c01775d2 100644
--- a/libavcodec/codec_par.c
+++ b/libavcodec/codec_par.c
@@ -154,7 +154,8 @@ int avcodec_parameters_from_context(AVCodecParameters *par,
 
     switch (par->codec_type) {
     case AVMEDIA_TYPE_VIDEO:
-        par->format              = codec->pix_fmt;
+        par->format              = codec->sw_pix_fmt != AV_PIX_FMT_NONE ?
+                                   codec->sw_pix_fmt : codec->pix_fmt;
         par->width               = codec->width;
         par->height              = codec->height;
         par->field_order         = codec->field_order;

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

Reply via email to