[FFmpeg-devel] [PATCH] ffmpeg.c: copy global metadata by default.

Anton Khirnov wyskas
Wed Jun 2 11:20:13 CEST 2010


On Wed, Mar 31, 2010 at 11:15:05AM +0200, Michael Niedermayer wrote:
> On Thu, Mar 18, 2010 at 08:54:14PM +0100, Anton Khirnov wrote:
> > Metadata is copied from the first input file with at least one tag to
> > all output files.
> > ---
> >  ffmpeg.c |   20 ++++++++++++++++++++
> >  1 files changed, 20 insertions(+), 0 deletions(-)
> > 
> > diff --git a/ffmpeg.c b/ffmpeg.c
> > index 5a22dde..a04f052 100644
> > --- a/ffmpeg.c
> > +++ b/ffmpeg.c
> > @@ -2175,6 +2175,26 @@ static int av_encode(AVFormatContext **output_files,
> >                                      in_file->iformat->metadata_conv);
> >      }
> >  
> > +    if (!nb_meta_data_maps) {
> > +        for (i = 0; i < nb_input_files; i++) {
> > +            is = input_files[i];
> > +
> > +            if (!av_metadata_get(is->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
> > +                continue;
> > +
> > +            for (j = 0; j < nb_output_files; j++) {
> > +                AVMetadataTag *t = NULL;
> > +
> > +                os = output_files[j];
> > +                while ((t = av_metadata_get(is->metadata, "", t,
> > +                                            AV_METADATA_IGNORE_SUFFIX)))
> > +                    av_metadata_set2(&os->metadata, t->key, t->value, 0);
> > +                av_metadata_conv(os, os->oformat->metadata_conv,
> > +                                 is->iformat->metadata_conv);
> > +            }
> 
> this looks buggy, if there where any metadata tags in os already 
> av_metadata_conv() would convert them too

Should be fixed with attached patches.

Anton Khirnov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-metadata-add-av_metadata_copy-function.patch
Type: text/x-diff
Size: 3230 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100602/77b0463e/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-ffmpeg.c-copy-global-metadata-by-default.patch
Type: text/x-diff
Size: 1363 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100602/77b0463e/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100602/77b0463e/attachment.pgp>



More information about the ffmpeg-devel mailing list