[Vorbis-dev] command line perl tool to create ogg/Vorbis picture comments

Ian Malone ibmalone at gmail.com
Mon Apr 16 17:56:00 PDT 2012


On 14 April 2012 23:40, Ian Malone <ibmalone at gmail.com> wrote:
> On 14 April 2012 23:34, Ian Malone <ibmalone at gmail.com> wrote:
>
>> http://pastebin.com/xXhPyZuQ
>
>> ./jpegtoblock.pl  -i DSCN7376.JPG -o flacblock
>
>> You'll need to add the "METADATA_BLOCK_PICTURE=" which makes it into a
>> comment file yourself.
>>
>
> Like:
> echo -n "METADATA_BLOCK_PICTURE=" | cat - flacblock > flacblock.comment

It turns out I'm crazy...

https://github.com/imalone/oggflacblock
Or direct from (n.b. BSD license):
https://raw.github.com/imalone/oggflacblock/master/oggflacblock.pl

Now handles png and jpeg, the only notable dependency is the Perl
Image::ExifTool module. (Which, I've noticed, can also read Vorbis
comments)

Includes usage info with -h or -help, but interesting things:
./oggflacblock.pl -i sample.png -o sample.tag -write tag -desc "Some
description" -type FileIconSmall

-write tag : produces a file with the "METADATA_BLOCK_PICTURE=" start,
so you can plug it straight into vorbiscomment. This is the default,
so you can do this:
vorbiscomment startfile.ogg newfile.ogg -a -c sample.tag
the other options are block64 (just the block as before) and blockraw
(don't 64bit encode)

-type, can be numeric, or I've come up with some short-names for the
different entries that you can specify instead.

FileIconSmall is restricted to 32x32 png, this is enforced.

Shortcomings:
* Doesn't do the "->" mode.
* Doesn't provide the palette count, I haven't tried to figure that out.
* For JPEG finds bit depth as bits per sample * channel count. This
might not be correct.
* Haven't made certain the description handling is UTF-8 clean, may
depend on locale at the moment.
* It's in Perl. But if it wasn't I'd still be trying to finish it.
* Testing is still patchy, the raw headers look right and the jpeg
results are identical to those from the earlier version (which I tried
out today in Media Monkey and appear to work).

-- 
imalone
http://ibmalone.blogspot.co.uk


More information about the Vorbis-dev mailing list