[FFmpeg-devel] [PATCH] lavf/aiffenc: write APIC frames at the beginning of ID3 metadata

Matthieu Bouron matthieu.bouron at gmail.com
Tue May 28 19:35:42 CEST 2013


Fixes covert art display for iTunes, Traktor, Serato and Torq.
---

Hello there,

Actually, ID3 covert arts (APIC frames) in AIFF files are not
recognized/displayed by iTunes, Traktor, Serato and Torq
softwares. This patch fix this issue by writing APIC frames at
the beginning of the ID3 metadata.

To be honest i have no idea why this softwares do not recognize
the APIC frames when there are written at the end of the ID3 metadata.
Looking at the differences between a valid file and the file generated by
ffmpeg did not help me. The main difference was the encoding choosen for
the frame description and forcing it to ISO 8859-1 did not help.

The other difference was that the APIC frames were at the beginning of
the ID3 data.

Nonetheless, it does the trick. Please comment,
Matthieu

---
 libavformat/aiffenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index 7c0b4fb..e74c8c5 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -58,12 +58,12 @@ static int put_id3v2_tags(AVFormatContext *s, AIFFOutputContext *aiff)
     pos = avio_tell(pb);
 
     ff_id3v2_start(&id3v2, pb, aiff->id3v2_version, ID3v2_DEFAULT_MAGIC);
-    ff_id3v2_write_metadata(s, &id3v2);
     while (pict_list) {
         if ((ret = ff_id3v2_write_apic(s, &id3v2, &pict_list->pkt)) < 0)
             return ret;
         pict_list = pict_list->next;
     }
+    ff_id3v2_write_metadata(s, &id3v2);
     ff_id3v2_finish(&id3v2, pb);
 
     end = avio_tell(pb);
-- 
1.8.2.3



More information about the ffmpeg-devel mailing list