Several people have looked for a way to store images, such as cover
art, inside FLAC metadata
blocks. (Mostly because several players such as the slimserver and the iPod can now
display the album cover.) The standard FLAC distribution and its
metaflac tool don't have this capability yet, so I have
rolled my own:
flac-image.tar.gz (13k)
in subversion:
https://svn.cs.pomona.edu/sys/src/flac-image/
The tar ball contains a binary compiled on Debian, but if that doesn't work, it is trivial to compile your own. It is also pretty trivial to use:
mikey@ember:~$ flac-image
flac-image 1.00, Copyright (c) 2005 Michael A. Dickerson
Usage:
flac-image (-x | -i <imagefile> | -d | -n | -l) [-t <mimetype>] flacfile ...
-x: eXtract images in flacfile to current directory
-i: Insert image <imagefile> in flacfile
-d: Delete image blocks in flacfile
-n: extract only the smallest available image block (thumbNail)
-l: List recognized image blocks
-t: with -i, use <mimetype> instead of guessing based on filename
with any other operation, process only the blocks that match
<mimetype>
For FLAC hackers: the APPLICATION block that I use is registered as 0x696d6167 (ASCII "imag") and has the following structure (from flac-image.h).
/* This struct is the "specification" for the flac-image APPLICATION data
block. The binary image data is prepended with this 72-byte header:
vers - header structure version number. The only defined value is
0x0001.
mimetype - 32 byte char buffer meant to describe the block content type
(although this program could care less, and just treats the
mimetype field as a kind of label.)
filename - 32 byte char buffer meant to record the name of the original
file. Programs are free to ignore this when extracting files.
This program stores the last component of the original filename
when importing, and uses the same name when exporting.
datasize - number of bytes of binary data that follow the header.
*/
typedef struct {
unsigned int vers;
char mimetype[IMAGE_HEADER_MIMETYPE_MAXLEN];
char filename[IMAGE_HEADER_FILENAME_MAXLEN];
unsigned int datasize;
} flac_image_header;
Josh has indicated that he intends to incorporate something like this in the next release of FLAC. When that happens, it should be simple to convert my image blocks to the standard scheme.
19 Jan 2005 01:47 PT - persistent link - trackback - 0 comments

4171622

