Monday, July 14, 2008

m4a clip meta data problem

m4a clip meta data problem:
-------------------------------------------
we are having two different APIs to read iTune based file format and other 3GP standard file format;
iTune file format is based on Quicktime file format;
They called the m4a file as iTune file format;
M4A,MP4,M4V, MSNV ( MSNV for Sony PSP Video) files are based on the MPEG4 File Format;
MPEG4 File format is based on Quicktime container format;
iTune is also follows Quicktime container format;So quicktime 3GP,MP4 are all based on Quicktime container format;
Even though we rename the files from mp4 to 3GP or 3GP to mp4, the Quicktime displays the video and audio with meta data;
We are having two set of APIs One is to read meta data from Quicktime Meta data(Mp4) and another one is to read meta data from the
3GP file;
Solution:
------------
1.We can call the two APIs Successively to get the meta data information from a file;
2.We can call the Meta data APIs based on file type
( It may not display meta data if we renamed the 3GP file to MP4 file)
3.One more Solution is checking the File format;




Quicktime's iTune,MP4 and 3GP uses the same container format;
Atom:
--------
We can call the meta data APIs based on the file atom;
if the atom is 'ftyp';
Atom Syntax:
--------------
ftyp PreferredBrand MinorVersion CompatibleBrands NULL
Example:
ftyp 3GP4 00 00 02 00( version in Hex) 3Gp4 isom mp41
Compatible brands are
3GP4 isom, mp41;

Preferred Brand:
-----------------
1.4 bytes code ( it may be like 3GP or mp4)
Note:
--------
the Preferred Brand must occur in Compatible Brands list;

3GP standards may have the following
3GP4
3GP5
3GP6
So we will compare the first 3 codes with 3GP, if it is zero


if(_stricmp(code,"3gp") == 0) //Start Code is Equal;
{
}

for MP4 file, it may have mp4,m4v,m4a and isom and so on;
mp41,mp42
so we can make a check like "mp4" with first 3 start codes;
While downloading the MP4 file I faced the problem; its ftyp or Brand code is equal
to 'MSNV' it is not matching to any of the format;MSNV is a sony video PSP recorder format;
Quicktime will do the following to check the file format;

ftyp 3GP4 00 00 02 00( version in Hex) 3Gp4 isom mp41


Quicktime will enumerates the compatible Brands;
Quicktime will checks whether the file is according to the 3GP4 Spec,if it is not, then it will checks
the file format is in isom and if the file format is not in a format of Isom, then Quicktime will check with the
mp41 format; if it is the correct format, then according to the file format,Quicktime will read data from the
file; if media file is not matched with any of the compatible brands, then it will throw "Invalid file format specification"
error;

No comments: