Help - Search - Members - Calendar
Full Version: Mp4 support now added to opensrc jaudiotagger library
Hydrogenaudio Forums > Lossy Audio Compression > AAC > AAC - Tech
paultaylor
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
paultaylor
QUOTE(paultaylor @ Oct 12 2007, 16:13) *

2. How do you calculate number of channels/Stereo ?

In the spirit of information sharing did this with by searching for
MOOV.TRAK.MDIA.MINF.STBL.STSD.MP4A
and finding it within the MP4A atom (bytes 16,17)
menno
QUOTE(paultaylor @ Oct 26 2007, 14:43) *

QUOTE(paultaylor @ Oct 12 2007, 16:13) *

2. How do you calculate number of channels/Stereo ?

In the spirit of information sharing did this with by searching for
MOOV.TRAK.MDIA.MINF.STBL.STSD.MP4A
and finding it within the MP4A atom (bytes 16,17)

You should not expect that that value always has valid information (it's even defined differently between different subparts of the mpeg-4 standard). To have a better idea you should decode the audio specific config.
paultaylor
QUOTE(menno @ Oct 26 2007, 13:58) *

You should not expect that that value always has valid information (it's even defined differently between different subparts of the mpeg-4 standard). To have a better idea you should decode the audio specific config.

Im only dealing the with the case of a file containing a single audio track (AAC encoded), in that case doesnt it always have this MP4A atom, which atom is the audio specific config ?
menno
QUOTE(paultaylor @ Oct 26 2007, 16:09) *

QUOTE(menno @ Oct 26 2007, 13:58) *

You should not expect that that value always has valid information (it's even defined differently between different subparts of the mpeg-4 standard). To have a better idea you should decode the audio specific config.

Im only dealing the with the case of a file containing a single audio track (AAC encoded), in that case doesnt it always have this MP4A atom, which atom is the audio specific config ?


Yes, when there's an AAC track there should be a mp4a atom, but I mean that the "channels" value is not always the actual amount of channels (usually just 2 gets written there). The audioSpecificConfig is somewhere in the ESDS part.
paultaylor
QUOTE(menno @ Oct 26 2007, 16:25) *

Yes, when there's an AAC track there should be a mp4a atom, but I mean that the "channels" value is not always the actual amount of channels (usually just 2 gets written there). The audioSpecificConfig is somewhere in the ESDS part.

Your'e right, I have just found a file file shown as Mono in iTunes but recording 2 in the channels value. havent managed to work out the ESDS part yet.
paultaylor
Ok thanks, fixed found no of channels in section 5 of esds atom (Also got bit rate from section 4 of esds atom)
paultaylor
Ive resolved the problems above, and posted a release at:
here
try out at your leisure.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.