The branch, master has been updated
       via  e442128944cf1034b33346180021c1f747d5bd99 (commit)
       via  27f556188557786f0ead2147b1eea3c36795cfdd (commit)
      from  dc39a576ad8c489bf229c4acdf5c347b1dd264b2 (commit)


- Log -----------------------------------------------------------------
commit e442128944cf1034b33346180021c1f747d5bd99
Author:     Martin Storsjö <[email protected]>
AuthorDate: Tue Oct 14 13:49:04 2025 +0300
Commit:     Martin Storsjö <[email protected]>
CommitDate: Tue Oct 21 08:38:32 2025 +0000

    movenc: Make sure to flush the delayed moov atom for hybrid fragmented
    
    If using the delay_moov flag in combination with hybrid_fragment
    (which is a potentially problematic combination otherwise - the
    ftyp box does end up hidden in the end), then we need to flush
    twice to get both the moov box and the first fragment, if the
    file is finished before the first fragment is completed.

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index bdbe1a4150..218a285821 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -8610,7 +8610,7 @@ static int mov_write_trailer(AVFormatContext *s)
     if (!(mov->flags & FF_MOV_FLAG_FRAGMENT) ||
         mov->flags & FF_MOV_FLAG_HYBRID_FRAGMENTED) {
         if (mov->flags & FF_MOV_FLAG_HYBRID_FRAGMENTED) {
-            mov_flush_fragment(s, 1);
+            mov_auto_flush_fragment(s, 1);
             mov->mdat_size = avio_tell(pb) - mov->mdat_pos - 8;
             for (i = 0; i < mov->nb_tracks; i++) {
                 MOVTrack *track = &mov->tracks[i];

commit 27f556188557786f0ead2147b1eea3c36795cfdd
Author:     Martin Storsjö <[email protected]>
AuthorDate: Tue Oct 14 13:47:03 2025 +0300
Commit:     Martin Storsjö <[email protected]>
CommitDate: Tue Oct 21 08:38:32 2025 +0000

    movenc: Fix sample clustering for hybrid_fragmented+delay_moov
    
    If samples were available when the moov was written, chunking
    for those samples has been done already, which has to be reset
    here.
    
    This is the case when not using empty_moov, when the moov box
    describes the first fragment - this case was accounted for already.
    But if using the delay_moov flag, then those samples also were
    available when writing the moov, so chunking for them has already
    been done in this case as well.
    
    Therefore, always reset chunking here (it should be harmless to
    always do it), and update the comment to clarify the cases
    involved here.

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index cd66a39518..bdbe1a4150 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6390,8 +6390,10 @@ static int mov_finish_fragment(MOVMuxContext *mov, 
MOVTrack *track,
     if (mov->flags & FF_MOV_FLAG_HYBRID_FRAGMENTED) {
         for (i = 0; i < track->entry; i++)
             track->cluster[i].pos += ref_pos + track->data_offset;
-        if (track->cluster_written == 0 && !(mov->flags & 
FF_MOV_FLAG_EMPTY_MOOV)) {
-            // First flush. If this was a case of not using empty moov, reset 
chunking.
+        if (track->cluster_written == 0) {
+            // First flush. Chunking for this fragment may already have been
+            // done, either if we didn't use empty_moov, or if we did use
+            // delay_moov. In either case, reset chunking here.
             for (i = 0; i < track->entry; i++) {
                 track->cluster[i].chunkNum = 0;
                 track->cluster[i].samples_in_chunk = track->cluster[i].entries;

-----------------------------------------------------------------------

Summary of changes:
 libavformat/movenc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)


hooks/post-receive
-- 

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

Reply via email to