mbaros
mbaros

Reputation: 845

mp4v2 extracting and decoding data from .M4A file

I have extracted the audio data from .m4a file using mp4v2 library (sample-by-sample). Does this library have function that decodes the data? Anybody with experience with this library and can provide some help?

The documentation says:

MP4ReadSample function reads the specified sample from the specified track. Typically this sample is then decoded in a codec dependent fashion and rendered in an appropriate fashion.

I am interesed in decoding the output.

Thanks in advance.

Upvotes: 0

Views: 1204

Answers (2)

VC.One
VC.One

Reputation: 15881

You tagged MP4(video data) and M4A(audio data). Since you are extracting from M4A, I can only imagine you actually have either AAC or MP3 audio data.

Each extracted sample (bytes) is audio frame.

To make a playable MP3 file : Simply join all MP3 frames' bytes together. Save as .mp3 to play later.

To make a playable AAC file : For each AAC frame, first create an ADTS header (7 bytes) followed by that frame's data. You can test your header bytes here (site shows what your byte values mean). When all your AAC frames each begin with an ADTS header, simply save as .aac to play later using some audio payer code.

Upvotes: 1

mbaros
mbaros

Reputation: 845

I have researched everything and the answer is NO. There is no decoder in mp4/mp4v2 libraries. One has to use some other library to do that.

Upvotes: 0

Related Questions