Converting Ogg’s COVERART tag

Sebastian Dröge sebastian at centricular.com
Sat Dec 7 02:31:19 PST 2013


On Fr, 2013-12-06 at 15:37 +0100, Marcus Habermehl wrote:
> Hi.
> 
> I have some Ogg files with the deprecated COVERART tag that I would like
> to convert to the METADATA_BLOCK_PICTURE tag.
> 
> For this I have written a small Python script to automatically do this
> with GStreamer.
> 
> How I can read tags, modify and write back I have already found out.
> 
> Unfortunately, the GST_TAG_IMAGE is not written as I expected. But I do
> not know if this is due to my code, or due to the GIR bindings.
> 
> I get the original tags from the bus with a first pipeline (urisrc !
> oggdemux ! oggmux ! fakesink). With these tags I create a modified
> GstTagList.
> 
> The COVERART tag is here changed from GST_TAG_PREVIEW_IMAGE to
> GST_TAG_IMAGE and for the value I create a new GstSample. (‘value’ is
> the value of the original tag.)
> 
> buffer = value.get_buffer()
> mime_struct = value.get_caps().get_structure(0)
> mime_type = mime_struct.get_name()
> 
> structure = Gst.Structure.new_empty(mime_type)
> structure.set_value("height", mime_struct.get_value("height"))
> structure.set_value("image-type", GstTag.TagImageType.FRONT_COVER)
> structure.set_value("width", mime_struct.get_value("width"))
> 
> caps = Gst.Caps.new_empty()
> caps.append_structure(structure)
> 
> sample = Gst.Sample.new(value.get_buffer(), caps, value.get_segment(), None)
> 
> The modified GstTagList is written with a second pipeline (urisrc
> oggdemux ! vorbistag ! oggmux ! urisink) correctly. But in GST_TAG_IMAGE
> the ‘image-type’ field is removed from the GstSample. At least it is
> when I reading the written tags no longer present.

The code is writing the image type, or at least tries to. Does it show
up in other software that does not use GStreamer? Can you provide a file
that was created this way?

> I also found no hint in the documentation, how can I set a description
> for the image.

Setting a description is currently not supported, could you file a
feature request bug about that at http://bugzilla.gnome.org against
GStreamer? Should be easy to add in
gst-plugins-base/gst-libs/gst/tag/gstvorbistag.c

-- 
Sebastian Dröge <sebastian at centricular.com>
Centricular Ltd - http://www.centricular.com
Expertise, Straight from the Source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 966 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20131207/53fb3386/attachment.pgp>


More information about the gstreamer-devel mailing list