m4a格式资源集合

转载:http://www.file-recovery.com/m4a-signature-format.htm

MPEG-4 Part 14 Audio (M4A,M4B,M4P) Format & Recovery Example

M4A is a file extension for an audio file encoded with Advanced Audio Coding (AAC) which is a lossy compression. M4A stands for MPEG 4 Audio. Audio-only MPEG 4 container files usually have an M4A file extension. The MPEG-4 file format specification was based on the QuickTime format specification. M4A file quality is better and file sizes smaller compared to MP3 files. M4A files sound better than MP3 files when encoded at the same bit rate. The reason that these file extensions are so common is that they have been adopted by Apple for use in the iTunes Music Store.

M4B format is only different from M4A because it can be bookmarked allowing an MP3 player to return exactly to the last listening point. M4B is popular for audiobooks and podcasts for this very reason.

M4P is Apple's version of the M4A format that includes DRM protection, called FairPlay. This is the format used for protected music purchased from the iTunes Music Store.

MPEG-4 Part14 (M4A,M4B,M4P) files consist of consecutive chunks. Each chunk has 8 byte header: 4-byte chunk size (big-endian, high byte first) and 4-byte chunk type - one of pre-defined signatures: "ftyp", "mdat", "moov", "pnot", "udta", "uuid", "moof", "free", "skip", "jP2 ", "wide", "load", "ctab", "imap", "matt", "kmat", "clip", "crgn", "sync", "chap", "tmcd", "scpt", "ssrc", "PICT".

First chunk must be of type "ftype" and has a sub-type at offset 8. M4A defined by sub-type which must be "M4A_", for M4B sub-type must be "M4B_" and for M4P sub-type must be "M4P_".

Iterating chunks, until chunk of unknown type is detected, we compose MPEG-4 Audio file.

Let's examine the sample

When inspecting sample.m4a file's binary data using any Hex Viewer, like Active@ Disk Editor we can see it starts with a signatureftyp (hex: 66 74 79 70) at offset 4, which defines QuickTime Container File Type. File sub-type is M4A_ (hex: 4D 34 41 20) which points to M4A file type. First block size is 24 (hex: 00 00 00 18, big-endian, highest byte first), size located at offset 0. At offset 24 (hex: 18) is located the second chunk, which has a size of 8 and type free (hex: 66 72 65 65). The next chunk is located at offset 24+8=32 (hex: 20) and has a size 93,590 (hex: 00 01 6D 96) and type mdat (hex: 6D 64 61 74) at offset 36 (hex: 24). The next chunk is located at offset 32 + 93,590=93,622 (hex: 01 6D B6) and has a size 2,476 (hex: 00 00 09 AC) and type moov (hex: 6D 6F 6F 76) at offset 93,626 (hex: 01 6D BA). This is the last chunk, so total file size is 93,622+2,476 =96,098 bytes. M4A Audio format - header inspection

 


https://wiki.multimedia.cx/index.php?title=Apple_Lossless_Audio_Coding

More info:




Apple LosslessAudio Coding

·        FOURCCS: alac

·        Company: Apple

·        Technical Description: http://craz.net/programs/itunes/alac.html

·        Samples: http://samples.mplayerhq.hu/A-codecs/lossless/ (luckynight.m4a)

Apple Lossless Audio Coding using linear predictionwith Golomb-Rice coding ofthe difference. Similar to FLAC, although the bitstreams are not compatible.Usually stored in an MP4 container, as a private extensionsince it is not part of the MPEG-4 standard.

On October 27, 2011, ALAC was open sourced under theApache License 2.0. The source can be found at http://alac.macosforge.org/.

Contents

 [hide

·        1 Extradata

·        2 FrameHeader

·        3 Verbatimframe

·        4 Compressedframe

·        5 FrameFooter

Extradata

Syntax

Number of bits

Semantics

atom size

32

(0x24), big-endian

tag

32

'alac'

???

32

zero ?

max sample per frame

32

???

8

zero ?

sample size

8

rice history mult

8

rice initial history

8

rice kmodifier

8

channels

8

 ?

???

16

max coded frame size

32

bitrate

32

 ?

samplerate

32

Frame Header

Syntax

Number of bits

Semantics

channels

3

Number of channel -1 (Should be the same than in extradata ???)

 ???

4

 ??? (seem to be always 0)

 ???

12

 ??? (seem to be always 0)

hasoutputsamples

1

the number of samples is stored in the header

wasted_bytes

2

unknow (same as flac ???)

isverbatim

1

if 1, the data is not compressed

if (hasoutputsamples) {

outputsamples

32

number of samples (sometimes the value is wrong [1])

}


[1] http://www1.mplayerhq.hu/MPlayer/samples/A-codecs/lossless/luckynight.m4a need+ 32 and http://www1.mplayerhq.hu/MPlayer/samples/A-codecs/lossless/ALAC/old_midi_stuff.m4a +112

Verbatim frame

Syntax

Number of bits

Semantics

data

sample_size * outputsamples * channels

Unencoded subblock

Compressed frame

Syntax

Number of bits

Semantics

interlacing_shift

8

should be 0 if no channel interlacing.

interlacing_leftweight

8

for each channel {

prediction_type

4

should be 0

prediction_quantitization

4

ricemodifier

3

predictor_coef_num

5

predictor_coef_table

16 * predictor_coef_num

}

for each channel {

compressed data

modfied Rice coding and Adaptive FIR filter

}

Channel Interlacing

It is a mid/side stereo with weight. channel 0 is themid(average) channel, channel 1 is the side(difference) channel.

right = mid -((difference * interlacing_leftweight) >> interlacing_shift)

left = right +difference

It seems we have interlacing_leftweight ==interlacing_shift in most of the samples

Frame Footer

Syntax

Number of bits

Semantics

EOF

3

should be always 7

Categories

·        LosslessAudio Codecs

·        Audio Codecs

Navigation menu

·  Log in

·        Page

·        Discussion

·       Read

·       View source

·       View history

窗体顶端

窗体底端

·        Main Page

·        Recent changes

·        Video Codecs

·        Video FourCCs

·        Audio Codecs

·        Container Formats

·        Game Formats

·        Subtitle Formats

·        Image Formats

·        All Categories

·        Randompage

Tools

·        What links here

·        Related changes

·        Specialpages

·        Printableversion

·        Permanentlink

·        Page information

·        This page was last modified on 27 October 2011, at 18:08.

·        This page has been accessed 23,223 times.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值