Converting Ogg’s COVERART tag

Sebastian Dröge sebastian at centricular.com
Mon Dec 16 03:42:57 PST 2013


On Mo, 2013-12-16 at 11:30 +0100, Sebastian Dröge wrote:
> On Mo, 2013-12-16 at 04:46 +0100, Marcus Habermehl wrote:
> > Sorry, for the late answer. I was very busy the last week.
> > 
> > Am 07.12.2013 11:31, schrieb Sebastian Dröge:
> > > 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 have installed an application that doesn’t use GStreamer and it shows
> > the image type as expected.
> > 
> > Here is an Ogg file that I have created this way:
> > http://ubuntuone.com/6LfawrpRf20KQHO4ZeGZTd
> 
> It correctly includes the image type in the GstSample here, it's a
> GST_TAG_IMAGE_TYPE_FRONT_COVER. How do you get the image type from the
> sample? The image type is supposed to be in the structure that you can
> get with gst_sample_get_info().
> 
> There's a bug here in gstvorbistag.c, where it takes the image-info from
> the caps when you *create* the tag but puts it into the info structure
> when it *reads* the tag from the file. Fixing that now.

Fixed now:
http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=5a48fb7cdb2ff34fcf8523bd7a3ae0f5587361ed

This will most likely be included in the 1.2.2 release too.

-- 
Sebastian Dröge, 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/20131216/f9ba902e/attachment.pgp>


More information about the gstreamer-devel mailing list