> I have some problems adding metadata to a mp4 or mov container, not sure if 
 > it's a problem in avformat or if I'm doing something wrong.

I found the answer by myself, after looking at the binary ffmpeg that has the 
same problem if doing:

ffmpeg -i input.mp4 -metadata hello='world' -c copy output.mp4

... there is a lot more information in the net about the command line tools 
than the libraries :)

... I found here:

https://superuser.com/questions/1208273/how-to-add-new-and-non-defined-metadata-to-an-mp4-file

...that to output user metadatas ffmpeg need the option:

-movflags use_metadata_tags

... so I changed the avformat_write_header() call this way:

                av_dict_set(&options, "movflags", "use_metadata_tags", 0);
                /* Write the stream header, if any. */
                int ret = avformat_write_header(oc_, &options);
                // dictionary is copied inside write_header, we should free 
here our copy
                av_dict_free(&options);

... and now my metadatsa appear on the output file!

I hope this can be helpful for ppl having problems with this, that is not a 
very obvious behaviour.
_______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to