ID3v2 cover art insertion with Perl?
am 02.04.2008 08:21:46 von Seppo IngalsuoHi,
I'm struggling with my flac->mp3 music library maintenance script. based
on some net articles I have used MP3::Tag to attach cover art this way
use constant HEADER => ( chr(0x0) , "image/jpeg" , chr(0x0), "");
$img = new Image::Magick;
if (! $img->Read("$flacdir/cover.jpg")) {
$id3v2->add_frame( "APIC", HEADER, $img->ImageToBlob(magick => 'jpg'));
}
There is also setting
MP3::Tag->config("id3v23_unsync_size_w" => "TRUE");
See e.g. http://perl.thiesen.org/scripts/id3image
But I get corrupted cover art images in Amarok. iTunes and Windows Media
Player seem to work with it. MediaTomb uPnP server + PS3 doesn't find
the pictures. I'd like to get MediaTomb that uses taglib for metadata to
work.
There are Perl bindings for taglib in Audio::TagLib in CPAN. I'm able to
generate basic ID3v1 tags with it but nothing else since the
documentation is missing/minimal and I'm far from fluent in Perl to get
the information from Audio::TagLib source code. Any pointers how to do
proper ID3v2 APIC tags with Perl would be really helpful.
I found this but it seems to generate only ID3v1 tags based on "id3v2
-l" output and there is no example of
Audio::TagLib::ID3v2::AttachedPictureFrame
http://www.mfischer.com/2007/11/21/mp3-metadata-tagging/
BR,
Seppo