[Mp4-tech] Re:[audio] AAC file duration
Ralph Sperschneider
ralph.sperschneider iis.fraunhofer.de
Wed Nov 29 07:38:51 ESTEDT 2006
Madhurima.A aricent.com wrote:
>
>
> Hi
>
> I am implemneting AAC player.
> But I am facing problems in extracting the file duration. If I go and
> parse the whole file, time calculated is approximately same, but this
> takes considerable amount of time.
>
> Can anybody help me on this.
> How can I know the bit rate in case of a VBR file with ADTS/ADIF formats
>
>
> Regards,
> Madhurima
>
>
Dear Madhurima!
For ADIF, I do not see a simple solution in the case of VBR. In the case
of CBR the file duration can be derived based on the file length (the
only uncertainty is the difference of the bit reservoir stages at the
begin and the end of the file):
file_duration [s] = file_len [bit] / bitrate [bit/s]
For ADTS, you can count the available AAC frames (in the case of VBR and
CBR). This should be easy since the length of the frames is given in the
headers (only the header needs to be parsed in order to identify the
location of the next header). Based on the number of frames and the
sampling rate you can then derive the file duration:
frame_duration [s/frame] = 1024 [sample/frame] / sampling_rate [sample/s]
file_duration [s] = frame_duration [s/frame] * frame_cnt [frame]
Best regards,
Ralph
--
Dipl.-Ing. Ralph Sperschneider | Phone: +49 9131 776 344
Fraunhofer IIS | Fax: +49 9131 776 398
Am Wolfsmantel 33 | mailto:ralph.sperschneider iis.fraunhofer.de
D 91058 Erlangen | http://www.iis.fraunhofer.de/amm/
More information about the Mp4-tech
mailing list