PR #24534 opened by AYOUB NABIL BOUBAGRAT (ayoubnabil)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24534
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24534.patch

the MOV demuxer reads composer metadata, but the muxer drops it. write the ©wrt 
atom so the tag survives remuxing to MOV.

added a FATE test that fails before the fix and passes after. output without 
composer metadata stays byte-identical.


From 879710294f4b278f363a95c7bfa78adfd957aea6 Mon Sep 17 00:00:00 2001
From: Ayoub Nabil Boubagrat <[email protected]>
Date: Wed, 16 Sep 2026 11:37:59 +0200
Subject: [PATCH] avformat/movenc: preserve composer metadata in mov output

Signed-off-by: Ayoub Nabil Boubagrat 
<[email protected]>
---
 libavformat/movenc.c                 |  3 +++
 tests/fate/mov.mak                   |  8 ++++++++
 tests/ref/fate/mov-composer-metadata | 16 ++++++++++++++++
 3 files changed, 27 insertions(+)
 create mode 100644 tests/ref/fate/mov-composer-metadata

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index ecc6544bad..095472e22e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5126,6 +5126,9 @@ static int mov_write_udta_tag(AVIOContext *pb, 
MOVMuxContext *mov,
         mov_write_string_metadata(s, pb_buf, "\251nam", "title",       0);
         mov_write_string_metadata(s, pb_buf, "\251aut", "author",      0);
         mov_write_string_metadata(s, pb_buf, "\251alb", "album",       0);
+        /* mov_read_udta_string() already maps this atom back to "composer";
+         * without it a mov to mov remux dropped the tag on the floor. */
+        mov_write_string_metadata(s, pb_buf, "\251wrt", "composer",    0);
         mov_write_string_metadata(s, pb_buf, "\251day", "date",        0);
         mov_write_string_metadata(s, pb_buf, "\251swr", "encoder",     0);
         // currently ignored by mov.c
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 3c0ac3ec13..99a13b64d3 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -322,6 +322,14 @@ fate-mov-vfr: CMD = md5 -filter_complex 
testsrc=size=2x2:duration=1,setpts=N*N:s
 fate-mov-vfr: CMP = oneline
 fate-mov-vfr: REF = 1558b4a9398d8635783c93f84eb5a60d
 
+# The QuickTime user data list has to carry the composer atom the demuxer
+# already reads: without it a mov to mov remux dropped the tag.
+FATE_MOV_FFMPEG_FFPROBE-$(call TRANSCODE, PCM_S16LE, MOV, WAV_DEMUXER 
ARESAMPLE_FILTER) += fate-mov-composer-metadata
+fate-mov-composer-metadata: tests/data/asynth-44100-2.wav
+fate-mov-composer-metadata: CMD = transcode wav 
./tests/data/asynth-44100-2.wav mov \
+    "-af aresample -c:a pcm_s16le -t 0.05 -metadata composer=Bach" \
+    "-af aresample -c:a pcm_s16le" "-show_entries format_tags"
+
 FATE_MOV_FFMPEG_FFPROBE-$(call ALLYES, COLOR_FILTER SETPTS_FILTER 
MPEG4_ENCODER \
                                       MOV_MUXER MOV_DEMUXER FILE_PROTOCOL)     
 \
                                       += fate-mov-vfr-bframes-derived-duration
diff --git a/tests/ref/fate/mov-composer-metadata 
b/tests/ref/fate/mov-composer-metadata
new file mode 100644
index 0000000000..684d81837e
--- /dev/null
+++ b/tests/ref/fate/mov-composer-metadata
@@ -0,0 +1,16 @@
+d048fc0f5b6381a44124c764a7850598 *tests/data/fate/mov-composer-metadata.mov
+9497 tests/data/fate/mov-composer-metadata.mov
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: pcm_s16le
+#sample_rate 0: 44100
+#channel_layout_name 0: stereo
+0,          0,          0,     1024,     4096, 0x29e3eecf
+0,       1024,       1024,     1024,     4096, 0x18390b96
+0,       2048,       2048,      157,      628, 0x4db5381d
+[FORMAT]
+TAG:major_brand=qt  
+TAG:minor_version=512
+TAG:compatible_brands=qt  
+TAG:composer=Bach
+[/FORMAT]
-- 
2.52.0

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

Reply via email to