[FFmpeg-devel] [PATCH] metadata conversion API

Aurelien Jacobs aurel
Thu Feb 26 02:13:51 CET 2009


There is one last and important issue I want to address with the new
metadata API.
Old API allowed client apps and muxers to get a few select well known
tags (title, author...). With the new API, there is no simple way to
do that, right now. For example, if you demux an ASF file, and want to
get the name of the album, av_metadata_get(..., "album", ...) won't
give you any results, because ASF stores this information in a tag
named "AlbumTitle". There are lots of examples with various demuxers,
even for simple common tags. This also prevent correct remuxing between
different containers.

One simple solution would be to force any demuxers to export their tags
respecting a well defined list of known common key names (for all tags
that have a corresponding common name). But this have issues which makes
this impractical. It looses information. The client app can't retrieve
the actual key names used in the original file. And this would prevent
lossless remuxing in the same container.

So I built up another solution. The principle is to allows (de)muxers
to associate a conversion table to a AVMetadata. This table describe
the correspondence between the native format key names and the generic
common key names. Then with this conversion table,
av_metadata_get(..., "album", ...) is able to get the native tag
corresponding the the generic "album" key. And a muxer is able to
convert a whole AVMetadata to it's own native format.

First patch implements this conversion table API.
Second patch just shows a simple example of usage of this API (yes
I know it duplicates the ff_asf_metadata_conv table and I don't
intend to apply it as is, it's only a simple incomplete and unclean
example for now).

Also note the the av_metadata_get_conv() function which may look useless
in this patch set, is in fact required for applications such as ffmpeg,
to "copy" the conv table from input format ctx to output format ctx.

And finally, here is a concrete example of what this API allows. A simple
stream copy of those Matroska tags:
  ALBUM: Under the Pink
generates the following ASF tags:
  AlbumArtist: Tori Amos
  AlbumTitle: Under the Pink

-------------- next part --------------
A non-text attachment was scrubbed...
Name: md_conv.diff
Type: text/x-patch
Size: 4156 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090226/acb06eef/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: md_conv_example.diff
Type: text/x-patch
Size: 3954 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090226/acb06eef/attachment-0001.bin>

More information about the ffmpeg-devel mailing list