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 a0bdfcee30 avformat/movenc: only write a DecoderSpecificInfo for 
codecs that define one
a0bdfcee30 is described below

commit a0bdfcee3092fe4511f1b52a58f0d37b7dafdae7
Author:     Baptiste Coudurier <[email protected]>
AuthorDate: Thu Nov 12 18:51:44 2026 -0800
Commit:     Baptiste Coudurier <[email protected]>
CommitDate: Fri Nov 13 16:44:46 2026 +0000

    avformat/movenc: only write a DecoderSpecificInfo for codecs that define one
    
    MP3 extradata copied from AVI ended up there.
    
    Fixes: #26006
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Signed-off-by: Baptiste Coudurier <[email protected]>
---
 libavformat/movenc.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 3030458ab9..c3fa66d816 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -795,11 +795,27 @@ static struct mpeg4_bit_rate_values 
calculate_mpeg4_bit_rates(MOVTrack *track)
     return bit_rates;
 }
 
+static int esds_has_decoder_specific_info(enum AVCodecID codec_id)
+{
+    switch (codec_id) {
+    case AV_CODEC_ID_AAC:
+    case AV_CODEC_ID_MP4ALS:
+    case AV_CODEC_ID_MPEG4:
+    case AV_CODEC_ID_VORBIS:
+    case AV_CODEC_ID_DVD_SUBTITLE:
+        return 1;
+    default:
+        return 0;
+    }
+}
+
 static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic
 {
     struct mpeg4_bit_rate_values bit_rates = calculate_mpeg4_bit_rates(track);
     int64_t pos = avio_tell(pb);
-    int decoder_specific_info_len = 
track->extradata_size[track->last_stsd_index] ?
+    int write_dsi = track->extradata_size[track->last_stsd_index] &&
+                    esds_has_decoder_specific_info(track->par->codec_id);
+    int decoder_specific_info_len = write_dsi ?
                                     5 + 
track->extradata_size[track->last_stsd_index] : 0;
 
     avio_wb32(pb, 0); // size
@@ -835,7 +851,7 @@ static int mov_write_esds_tag(AVIOContext *pb, MOVTrack 
*track) // Basic
     avio_wb32(pb, bit_rates.max_bit_rate); // maxbitrate
     avio_wb32(pb, bit_rates.avg_bit_rate);
 
-    if (track->extradata_size[track->last_stsd_index]) {
+    if (write_dsi) {
         // DecoderSpecific info descriptor
         put_descr(pb, 0x05, track->extradata_size[track->last_stsd_index]);
         avio_write(pb, track->extradata[track->last_stsd_index],

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