A first cut of Mp4 metadata support is now added to jaudiotagger Java library. I think this is the only open source Java library that reads and writes mp4 and m4a metadata (itunes format) its released under LGPL with code examples at
http://www.jthink.net/jaudiotagger/examples.jsp. It supports Reverse Dns Field and Multiple Cover Art in addition to the standard metadata fields.
It is working fine for my test cases, but there are some areas Im currently stumped on, if anybody could help me out with any of the following that would be great.
1. How do you properly calculate bitrate?
2. How do you calculate number of channels/Stereo ?
3. Most Fields with Byte type use a single byte (such as cpil and pgap) but tmpo requires two bytes, are there any other byte fields that require multiple bytes.
4.Are there any other binary fields except for the artwork (covr) field
5.How do you set the rtng field
6.In iTunes even if if select a genre from the list it still uses custom genre field (@gen) rather than the genr
field, how do I get it to use genr or ist now defunct.
7. What applications write mp4s with ID3v2 data instead.
8. When modificiations are made to a file my algorithm is as follows
if(total size of metadata under ilst atom ==original size)
(
replace data under ilst atom
)
else if(total size of metadata under ilst atom <original size)
(
replace data under ilst atom
modify size of ilst atom to match size of its metadata
increase size of free atom so meta atom is same size as before
)
else if(total size of metadata under ilst atom >original size)
(
if(total additional size required < (space in free atom - free atom header size))
(
replace data under ilst atom
modify size of ilst atom to match size of its metadata
decrease size of free atom so meta atom is same size as before
)
else
(
extra size = (additional size required - size of free atom)
replace data under ilst atom
modify size of ilst atom to match size of its metadata
dont write free atom
modify size field of meta, udta and moov atom adding extra size
)
)
So even in the last case i never have to chnage any data except the metadata itself and the sizes of its parent and the fiel plays , is this enough or is there anything else that has to be done.
thanks Paul
