Converting Ogg’s COVERART tag

Marcus Habermehl bmh1980de at gmail.com
Fri Dec 6 06:37:06 PST 2013


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.

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

It would be great if someone could help me here.

Greetings
Marcus


More information about the gstreamer-devel mailing list