mp4: stsd/mp4a/esds stsd/avc1/avcc

原文:http://doublescn.appspot.com/?p=1134002

mp4 stsd/mp4a/esds

00 00 00 27 65 73 64 73 00 00 00 00 03 19 00 02 ; …’esds……..

00 04 11 40 15 00 06 00 00 01 F4 00 00 01 F4 00 ; …@…………

05 02 12 10 06 01 02                            ; …….

Atom Box:
00 00 00 27 (box size) 65 73 64 73 (‘esds’) 00 00 00 00 (version + flag)

ES descriptor:
03 (tag) 19 (tag size) 00 02 (track_id) 00 (flag)

DecoderConfig descriptor:
04 (tag) 11 (tag size) 40 (MPEG-4 audio) 15 (audio stream) 00 06 00 (Buffersize DB)  00 01 F4 00 (max bitrate 128000) 00 01 F4 00 (avg bitrate 128000)

DecoderSpecific info descriptor
05 (tag) 02 (tag size) 12 10 (Audio Specific Config)

Audio Specific Config:
5 bits: object type
4 bits: frequency index
4 bits: channel configuration
1 bit: frame length flag
1 bit: dependsOnCoreCoder
1 bit: extensionFlag

Audio Object Types
MPEG-4 Audio Object Types:
0: Null
1: AAC Main
2: AAC LC (Low Complexity)
3: AAC SSR (Scalable Sample Rate)
4: … 

Sampling Frequencies
0: 96000 Hz
1: 88200 Hz
2: 64000 Hz
3: 48000 Hz
4: 44100 Hz
5: … 

Channel Configurations
0: Defined in AOT Specifc Config
1: 1 channel: front-center
2: 2 channels: front-left, front-right
3: 3 channels: front-center, front-left, front-right 
4: …  

frame length flag:
0: Each packet contains 1024 samples
1: Each packet contains 960 samples

Example:
1210h = 00010010 00010000b = 00010(AAC LC)  010 0 (44100Hz)  0010 (strero) 0 (1024 samples) 00 ( ? )

SL descriptor
06 (tag) 01 (tag size) 02 (always 2 refer from mov_write_esds_tag);

 

Reference:
ffmpeg-2.7/libavformat/movenc.c  mov_write_esds_tag
http://wiki.multimedia.cx/?title=Understanding_AAC
http://wiki.multimedia.cx/index.php?title=MPEG-4_Audio

mp4 stsd/avc1/avcc

00 00 00 34 61 76 63 43 01 64 00 28 FF E1 00 1C ; …4avcC.d.(….
67 64 00 28 AC 34 E4 00 80 06 FF 97 01 10 00 00 ; gd.(.4..€…….
03 00 10 00 00 03 03 00 F1 83 11 20 01 00 05 68 ; ……….. …h
EF B2 C8 B0 ; ….

00 00 00 34: box size
61 76 63 43: avc1
01 64 00 28: 01 (version) 64 (AVC profile_idc) 00 (AVC profile compatibility) 28 (AVC level indication) 
FF: FF /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */)
The value of this field shall be one of 0, 1, or 3 corresponding to a length encoded with 1, 2, or 4 bytes, respectively. 

E1: E1 (/* 3 bits reserved (111) + 5 bits number of sps (00001) */)
00 1C: sps_size 28
67 64 00 … : sps without start code (00 00 01)
01: number of pps
00 05: pps size
68 EF B2 C8 B0: pps 


Now you should write H264 bitstream to mdat section and startcode (00 00 01)insteaof nal size . And the nal size length is specified as FF. It’s 4 bytes declared here. 

Example:
00 00 00 3F 41 9E 42 42 FF 00 00 03 00 00 03 00 ; …?A.BB……..
00 03 00 00 03 00 00 03 00 00 03 00 00 03 00 00 ; …………….
03 00 00 03 00 00 03 00 00 03 00 00 03 00 00 03 ; …………….
00 00 03 00 00 03 00 00 03 00 00 03 00 00 03 00 ; …………….
00 EA 81                                        ; …

00 00 00 3F is the length of  41 9E 42 42  … 00 EA 81

 

Reference:
ffmpeg-2.7/libavformat/avc.c: ff_isom_write_avcc 
ISO/IEC 14496-15: http://www.nhzjj.com/asp/admin/editor/newsfile/201011314552121.pdf 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值