add custom tags to flac file.

Thiago Sousa Santos thiagossantos at
Sun Aug 27 20:48:24 UTC 2017

On Sat, Aug 26, 2017 at 5:00 PM, Jacobo Luis Mejías Albertos <
jalumeal at> wrote:

> I try to registry some custom tags with 'gst_tag_register()' for using it
> with flacenc, but when I do the merge the final output file only show the
> predefined tags.
> This is and excerpt of the code related with the problem:
> GstElement* encoder = gst_element_factory_make("flacenc", "encoder");
> ...
> for (auto& tag : mytags) // mytags are a std::multimap<const char*,
> constchar*>
>    gst_tag_register(tag.first, GST_TAG_FLAG_META, G_TYPE_STRING,
> tag.first, tag.second, gst_tag_merge_strings_with_comma);
> ...
> GstTagSetter* tagger = GST_TAG_SETTER(encoder);
> if (tagger) {
>   gst_tag_setter_set_tag_merge_mode(tagger, GST_TAG_MERGE_APPEND);
>   GstTagList* list = gst_tag_list_new_empty();
>   for (auto& tag : meta)
>      gst_tag_list_add_values(list, GST_TAG_MERGE_APPEND, tag.first,
> tag.second);
>   gst_tag_setter_merge_tags(tagger, list, GST_TAG_MERGE_APPEND);
>   gst_tag_list_unref(list);
> }
> gst_element_set_state(pipeline, GST_STATE_PLAYING);
> ...
> I do something bad or flacenc don't support custom tags ?

>From a quick look at gstflacenc.c, check add_one_tag function. It will use
the gst-plugins-base tag library to convert the tags to vorbis tags. The
gstvorbistag.c in gst-plugins-base is where this is one, check
gst_tag_to_vorbis_comments which uses gst_tag_to_vorbis_tag to match
gstreamer tags to vorbis tags. The likely reason it is not working is
because your custom tags are not part of the list it knows how to map.

You could also add your tags there, make it dynamically extensible and
provide functions to register custom tags or make it handle (somehow) tags
it doesn't know. Depends on your overall use case and how generic you want
this solution to be.

> --
> Jacobo Luis Mejías Albertos
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at

Thiago Sousa Santos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gstreamer-devel mailing list