PR #26001 opened by Baptiste Coudurier (bcoudurier)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26001
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26001.patch

When the `location` metadata has no language suffix, the `loci` box was written 
with a packed language of 0. 3GPP TS 26.244 requires three lower-case ISO 
639-2/T letters, so 0 is invalid, and Apple AVFoundation ignores such a `loci` 
box entirely. Write "und" (0x55C4) instead, which is also what AVFoundation 
itself writes.

The demuxer already maps "und" back to the plain `location` key, so FFmpeg 
still reads the file back the same way. An explicit language (`location-fra`, 
etc.) is written as before.

Tested:
- AVFoundation (`AVURLAsset.loadMetadata`): ffmpeg-written 3gp and mp4 files 
now expose `uiso/loci`, which they did not before.
- mov/mp4/3gp FATE tests pass; no ref changes, since no test writes `location`.

Found while looking at #25916 / #26000.

🤖 Generated with [Claude Code](https://claude.com/claude-code)



From 2c125467ce952711c312aede8c5511e2b963d846 Mon Sep 17 00:00:00 2001
From: Baptiste Coudurier <[email protected]>
Date: Thu, 12 Nov 2026 14:46:54 -0800
Subject: [PATCH] avformat/movenc: write und as the loci language when none is
 set

A zero packed language is invalid per 3GPP TS 26.244, and AVFoundation
ignores such loci boxes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Baptiste Coudurier <[email protected]>
---
 libavformat/movenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index f36072470f3..d44128926dd 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4879,7 +4879,7 @@ static int mov_write_loci_tag(AVFormatContext *s, 
AVIOContext *pb)
     avio_wb32(pb, 0);         /* size */
     ffio_wfourcc(pb, "loci"); /* type */
     avio_wb32(pb, 0);         /* version + flags */
-    avio_wb16(pb, lang);
+    avio_wb16(pb, lang ? lang : ff_mov_iso639_to_lang("und", 1));
     avio_write(pb, place, strlen(place) + 1);
     avio_w8(pb, 0);           /* role of place (0 == shooting location, 1 == 
real location, 2 == fictional location) */
     avio_wb32(pb, longitude_fix);
-- 
2.54.0

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

Reply via email to