diff options
author | Zhao Zhili <zhilizhao@tencent.com> | 2025-06-13 01:32:31 +0800 |
---|---|---|
committer | Zhao Zhili <zhilizhao@tencent.com> | 2025-06-16 10:55:04 +0800 |
commit | 920071355dd82a74ab9bfd879d42401702b83a5e (patch) | |
tree | 0c37cc5d79454fc1c5789b611ff866bdcff36404 /libavformat/movenc.c | |
parent | 98c281152c2baa064e113afedaa499177e52058d (diff) | |
download | ffmpeg-920071355dd82a74ab9bfd879d42401702b83a5e.tar.gz |
avformat/movenc: Fix editlist with hybrid_fragmented
The segment_duration must not be set to zero when writing the moov
atom for the second time. This is related to edit lists in standard
MP4 files.
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r-- | libavformat/movenc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index cd5b45f6fe..a651d6d618 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -4036,8 +4036,13 @@ static int mov_write_edts_tag(AVIOContext *pb, MOVMuxContext *mov, /* For fragmented files, we don't know the full length yet. Setting * duration to 0 allows us to only specify the offset, including * the rest of the content (from all future fragments) without specifying - * an explicit duration. */ - if (mov->flags & FF_MOV_FLAG_FRAGMENT) + * an explicit duration. + * + * For hybrid_fragmented during mov_write_trailer (mov->moov_written != 0), + * don't reset duration to zero. + */ + if (mov->flags & FF_MOV_FLAG_FRAGMENT && + !(mov->flags & FF_MOV_FLAG_HYBRID_FRAGMENTED && mov->moov_written)) duration = 0; /* duration */ |