* [FFmpeg-devel] [PATCH] avformat/movenc: Fix editlist with hybrid_fragmented
@ 2025-06-12 17:32 Zhao Zhili
2025-06-13 7:32 ` Martin Storsjö
0 siblings, 1 reply; 2+ messages in thread
From: Zhao Zhili @ 2025-06-12 17:32 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
From: Zhao Zhili <zhilizhao@tencent.com>
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.
---
libavformat/movenc.c | 9 +++++++--
1 file 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 */
--
2.46.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/movenc: Fix editlist with hybrid_fragmented
2025-06-12 17:32 [FFmpeg-devel] [PATCH] avformat/movenc: Fix editlist with hybrid_fragmented Zhao Zhili
@ 2025-06-13 7:32 ` Martin Storsjö
0 siblings, 0 replies; 2+ messages in thread
From: Martin Storsjö @ 2025-06-13 7:32 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Zhao Zhili
On Fri, 13 Jun 2025, Zhao Zhili wrote:
> From: Zhao Zhili <zhilizhao@tencent.com>
>
> 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.
> ---
> libavformat/movenc.c | 9 +++++++--
> 1 file 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 */
> --
> 2.46.0
LGTM, this sounds reasonable to me.
// Martin
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-13 7:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-12 17:32 [FFmpeg-devel] [PATCH] avformat/movenc: Fix editlist with hybrid_fragmented Zhao Zhili
2025-06-13 7:32 ` Martin Storsjö
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git