[FFmpeg-devel] Missing documentation of metadata keys

Stefano Sabatini stefano.sabatini-lala
Wed Oct 21 00:27:43 CEST 2009


On date Tuesday 2009-10-20 16:16:52 -0200, Ramiro Polla encoded:
> Hi,
> 
> On Tue, Oct 20, 2009 at 3:30 PM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
> > On Tue, Oct 20, 2009 at 1:10 PM, Bjoern Voigt <bjoern at cs.tu-berlin.de> wrote:
> >> If I scanned the source code right, metadata keys are static. If they are
> >> indeed more dynamic (dependent on compile options, libraries etc.), a more
> >> dynamic approach (like a "-list-metadata-keys" option for ffmpeg) would
> >> probably be a better idea.
> >
> > Regardless of static or not, this would be a good idea, IMHO.
> > Introspection is a great thing.

+1.
 
> Attached patch should be a good starting point to list the conversion
> tags from ffmpeg (and document its use in the manuals).

Duplicating information and synching docs with the code is always
brittle and leads to inaccurate / outdated documentation, I think is
better to provide some mechanism to make the user ask the requested
information directly to the program, either make the documentation
generated by the code.

> It doesn't
> list tags that are used for example in nut, which gets them using
> av_metadata_get(). Maybe there could be a way for all tags to be
> listed in AVOutputFormat.
> 
> Anyways, I don't plan on following up on this patch, it was just a
> moment of boredom, feel free to pick it up if it's useful =). And
> expect more replies from the metadata maintainers...
> 
> Ramiro Polla

> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c	(revision 20334)
> +++ ffmpeg.c	(working copy)
> @@ -32,6 +32,7 @@
>  #include <limits.h>
>  #include <unistd.h>
>  #include "libavformat/avformat.h"
> +#include "libavformat/metadata.h"
>  #include "libavdevice/avdevice.h"
>  #include "libswscale/swscale.h"
>  #include "libavcodec/opt.h"
> @@ -2604,8 +2605,25 @@
>      char *mid= strchr(arg, '=');
>  
>      if(!mid){
> +        if (!strcmp(arg, "list")) {
> +            const AVMetadataConv *conv;
> +            if (!file_oformat) {
> +                fprintf(stderr, "Output format must be specified to list metadata tags.\n");

Maybe better without the point, more consistent with most FFmpeg
messages.

> +                av_exit(1);
> +            }
> +            if ((conv = file_oformat->metadata_conv)) {
> +                int i = 0;
> +                fprintf(stderr, "Available metadata tags are:\n");
> +                while (conv[i].generic)
> +                    fprintf(stderr, "%s\n", conv[i++].generic);

stdout, suppose someone wants to grep the list of supported tags.

> +            } else {
> +                fprintf(stderr, "Output format has no metadata tags.\n");
> +            }
> +            av_exit(0);
> +        } else {
>          fprintf(stderr, "Missing =\n");
>          av_exit(1);
> +        }
>      }
>      *mid++= 0;

Regards.
-- 
FFmpeg = Fiendish Friendly MultiPurpose Exciting Glue



More information about the ffmpeg-devel mailing list