[FFmpeg-devel] [PATCH] mp3 muxer: write all metadata

Justin Ruggles justin.ruggles
Fri Sep 25 23:54:36 CEST 2009

Michael Niedermayer wrote:

> On Fri, Sep 25, 2009 at 06:03:19AM -0400, Justin Ruggles wrote:
>> Anton Khirnov wrote:
>>> Hi,
>>> with attached patch the mp3 muxer will write all available metadata, not
>>> just a few selected as it does now.
>>> btw shouldn't there be a list of standard ffmpeg tag names somewhere?
>> I agree that we should have a list of generic tag names (and their
>> formats if applicable).
>>> From ced4fae2478201b70b417f8a10c6be5d6d4404b6 Mon Sep 17 00:00:00 2001
>>> From: Anton Khirnov <wyskas at gmail.com>
>>> Date: Fri, 25 Sep 2009 09:04:42 +0200
>>> Subject: [PATCH] mp3 muxer: write all metadata
>>> ---
>>>  libavformat/mp3.c |   86 ++++++++++++++++++++++++++++++++---------------------
>>>  1 files changed, 52 insertions(+), 34 deletions(-)
>>> [...]
>>> +        if      (!strcmp(t->key, "album"))    tag = MKBETAG('T', 'A', 'L', 'B');
>>> +        else if (!strcmp(t->key, "composer")) tag = MKBETAG('T', 'C', 'O', 'M');
>>> +        else if (!strcmp(t->key, "genre"))    tag = MKBETAG('T', 'C', 'O', 'N');
>>> +        else if (!strcmp(t->key, "copyright"))tag = MKBETAG('T', 'C', 'O', 'P');
>>> +        else if (!strcmp(t->key, "date"))     tag = MKBETAG('T', 'D', 'R', 'L');
>> Using "date" is not compatible with other metadata readers/writers,
>> which all use "year".  Personally I think that all the readers/writers
>> should be changed to use "date" instead, in ISO format so that the year
>> would be the first 4 chars.  That way it would be usable for those
>> formats that only support the year.  An alternative would be to have a
>> fallback to use "year" for TDRL if "date" does not exist.
> is either of you aware of AVMetadataConv ?
> what can we do to make it more clear how the metadata api works?
> that is demuxers export the metadata that is stored in the file,
> muxers store it as it is provided to the muxer. There are some
> specific rules how trees and multiple tags are exportet but i dont
> see why one would rename all tag keys explixitly or reformat values in
> the demuxer
> That is what AVMetadataConv is for ...

AVMetadataConv does not solve the problem because it does not convert
from one metadata format to another.  It converts the key names to/from
a generic value.  All the formats still have to agree on what those
generic values are in order for the conversions to work properly.  For
example, we use "author" as the generic value for either artist or
author.  That is not documented anywhere, and it only works because it
is used by all of the metadata formats.  It needs to be specified
somewhere.  For other fields it is not as clear.

Also, it does nothing about differences in values that are not quite
compatible as-is but could be with some processing.  That is where date
vs. year comes in.  The current metadata formats and AVMetadataConv are
using "year" as the generic value for year or date.  This is not
accurate and can lead to problems in conversion.


More information about the ffmpeg-devel mailing list