mp4格式

下面的軟件下載地址:http://download.csdn.net/source/2607382

MP4格式縮率圖

ftyp:

?這是一個筐,可以裝mdat等其他Box?

例:00 00 00 14 66 74 79 70 69 73 6F 6D 00 00 02 00 6D 70 34 31
?語義為:ftyp: Major brand: isom
??Minor version: 512
??Compatible brand: mp41
free|skip
?
空白Box.裝在ftyp等筐里
?
例:00 00 00 08 66 72 65
?
語意為: free: (null)

moov:

?這是一個筐,里面很豐富
?
例:00 00 07 63 6D 6F 6F 76
?
本身屬性沒有。但后面全是它的內容

moov:mvhd:

?這是moovheader.
?
例:?00 00 00 6C 6D 76 68 64 00 00 00 00 7C 25 B0 80
??7C 25 B0 80 00 00 03 E8 00 00 06 14 00 01 00 00
??01 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00
??00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00
??00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00
??00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
??00 00 00 00 00 00 00 00 00 00 00 03???
????????

?語義:
?creation_time:2082844800???????modification_time:2082844800???
?timescale:1000?//
一秒分多少份,這里1000表示時間單位為1毫秒,這個設置很重要
?duration:1556?rate:10000
表示1.0?volume:100 表示最大聲
?reserved:0??reserved[0]:0???reserved[1]:0???
?Matric[0]:10000??Matric[1]:0??Matric[2]:0??Matric[3]:0??Matric[4]:10000?
?Matric[5]:0
 Matric[6]:0??Matric[7]:0??Matric[8]:40000000
?Predefined[0]:0??Predefined[1]:0??Predefined[2]:0??Predefined[3]:0
?Predefined[4]:0??Predefined[5]:0??next_track_ID:3

?

moov:trak: tkhd:

?這是track header
?
1?00 00 00 5C 74 6B 68 64 00 00 00 0F 7C 25 B0 80
??7C 25 B0 80 00 00 00 01 00 00 00 00 00 00 06 08
??00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
??00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
??00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
??40 00 00 00 02 40 00 00 01 E0 00 00?????
?????? 
?
語義:
?creation_time:2082844800?????modification_time:2082844800???
?track_ID:1
 第一軌index, 這個值很重要, 直接決定了視頻和音頻是否能同時出現, 如果音頻和視頻的track_ID都是1, 則會導致播放器無法播放.
?reserved_1:0 ?
?duration:1544?//
這個值對播放器很重要, 具體時間還和mvhdtimescale相關,用來指定了時長,1544個時間單位,如果是毫秒為單位,則為1544毫秒,
?volume:0
 //這是視頻軌,無音響 reserved_2[0]:0?????reserved_2[1]:0????????
?layer:0 //
由于我們的視頻只有一層,所以這里總是0
?alternate_group:0 reserved_3:0???
?Matric[0]:10000????Matric[1]:0????Matric[2]:0????Matric[3]:0??Matric[4]:10000???
?Matric[5]:0????Matric[6]:0????Matric[7]:0????Matric[8]:40000000
?width:2400000 height:1e00000?//
這兩個單位都要右移16位才靠譜

?2語義:
?creation_time:2082844800?????modification_time:2082844800???
?track_ID:2 reserved_1:0 duration:1556?//
這個值對播放器很重要, 用來指定了時長,具體時間還和mvhdtimescale相關
?volume:100 //
這是音頻軌,最大聲 reserved_2[0]:0???reserved_2[1]:0????????
?layer:0 //
只對視頻有意義 alternate_group:0 //總是0
?reserved_3:0????Matric[0]:10000????Matric[1]:0????Matric[2]:0????Matric[3]:0
?Matric[4]:10000????Matric[5]:0????Matric[6]:0????Matric[7]:0????Matric[8]:40000000
?width:0 height:0

moov:trak: mdia:

?這個Box沒有屬性,是一個筐,裝在trak

moov:trak: mdia: mdhd

?1:視頻
?creation_time:2082844800???modification_time:2082844800???
?timescale:24000?//
這個位決定了播放的速度,不過他與duration的相乘后還是可以對應上面的mvhd設置
?duration:37037
?pad:0
?Language[0]:21??????Language[1]:14??????Language[2]:4
?pre_defined:0
?
?
2:聲頻
?creation_time:2082844800???modification_time:2082844800???
?timescale:44100?
?duration:68608
?pad:0?//
這個位無意義,是為了將后面language湊夠16位之用
?Language[0]:21??????Language[1]:14??????Language[2]:4
?pre_defined:0

hdlr:?handler
?
1:視頻
?pre_defined:0 handler_type:vide //
似乎除了handler_type以外,其余的屬性無意義
?reserved0??????reserved:0??????reserved:0

?2:聲頻
?pre_defined:0 handler_type:soun
?reserved:0??????reserved:0??????reserved:0

moov:trak: mdia: minf: vmhd

?Video media header
例:?
?graphicsmode:0?//Video
軌的合成模式,未知語義
?opcolor:0????????opcolor:0????????opcolor:0?//
同樣未知

?

moov:trak: mdia: minf: dinf: dref

?Data referrence
?
例:
?entry_count:1?//
只有一條Entry
?url:??//
即使有也是沒內容,測試文件無論音視都沒有內容

?

moov:trak: mdia: minf: stbl: stsd

stsd: Sample Description box
?
這是一個table, 里面放有很多entry
?
例:entry_count:1 //視頻,有一條entry

VisualSampleEntry: stsd里裝的一條一條的視頻entry,
?
例:
?data_reference_index:1
?pre_defined[0]:0
?pre_defined[1]:0?pre_defined[2]:0
?width:576 height:480
?horizresolution:480000 vertresolution:480000?//
常數,即72dpi
?reserved:0 frame_count:1???compressorname://

?depth:24?//
顏色深度
?pre_defined:-1

AudioSampleEntry: stsd里裝的一條一條音頻entry
?
例:reserved[0]:0????????????reserved[1]:0
?channelcount:2 samplesize:16
 pre_defined:0 reserved_2:0
?samplerate:ac440000?//
顯然要右移16位才有意義

?

moov:trak: mdia: minf: stbl: stsd :mp4a

mp4a: aac box 這個box實際就是繼承了audio sample entry box
?reserved[0]:0????????????reserved[1]:0
?channelcount:2 samplesize:16
?pre_defined:0 reserved_2:0 samplerate:56220000

?

moov:trak: mdia: minf: stbl: stsd : esds

esds: 包含在mp4a,
?length:3
?ES_ID:6400
?streamDependenceFlag:0
?URL_Flag=0??reserved=0
?streamPriority:1 streamDependenceFlag:0
?dependsOn_ES_ID:52685
?m_iData_Size:23?//data
的長度,算出來的
?Data[23]?//
這里面有很一堆不知所云的數據, 一直到stts,但這堆數據極度重要,直接決定了解碼器能否解碼,14496-1里有定義
???//
實踐證明: 這組數據與采樣率有關,44100一組, 22050一組, 48000又是一組, 44100可以與48000共用一組

?

moov:trak: mdia: minf: stbl: stts

stts: Time to sample
?
1: 視頻
?entry_count:1
?sample_count:37?//
上面已經有duration時間了,duration指整個mdatvideo的時長,這里37卻為chunks數目
?sample_delta:1001?//1001 * 37=37037 sample_delta*sample_count=duration

?2: 音頻
?sentry_count:1
?sample_count:67 //
音頻分了67chunks
?sample_delta:1024?//
同上

?

moov:trak: mdia: minf: stbl: stss

stss: syn Sample box
?
1: 視頻
?entry_count:1
?sample_number:1

?但音頻里沒有這個box,
?
這個Box非常重要, 決定了整個mp4文件是否可以拖拉, 如果這個box只有一個entry,則拖拉時將cpu達到100%, 如果這個box不存在, 可以拖拉, 也不會達到100%, 但是會略等一會, 通常做法可以搞100.

?

moov:trak: mdia: minf: stbl: stsc

stsc: Sample To Chunk Box 這個box非常重要,指示了在某一個chunk開始后面的chunks里每chunk有多少個sample, 一個sample就是一幀
?
1:視頻?
?entry_count:1
?first chunk: 1, sample per chunk: 1, sample description index 1

?2:音頻
?entry_count:1
?first chunk: 1, sample per chunk: 1, sample description index 1

?

moov:trak: mdia: minf: stbl: stsz

stsz: Sample Size Box, 這個box乃重中之重, 指示了每個sample的大小
?
1:視頻
?sample size: 0?????????sample count: 37
?5127????855?????830?????2327????2742????2373????2716????2365????3061
?2170????1888????2427????2578????2218????2084????2138????2319????2586???
?2728????2322????3505????2624????1551????2725????2502????2072????1720???
?1382????2653????2177????1323????1492????1801????1765????1985????5028???
?3467
?
2:音頻
?sample size: 0?????????sample count: 65
?219?????205?????207?????182?????213?????194?????195?????194?????212
?188?????159?????179?????186?????189?????184?????184?????190?????188
?190?????186?????195?????196?????182?????197?????182?????186?????182
?182?????185?????182?????193?????186?????184?????187?????175?????173
?170?????185?????171?????181?????178?????178?????185?????192?????188
?187?????175?????167?????177?????182?????167?????173?????177?????175
?176?????174?????170?????168?????169?????180?????164?????167?????176????
?170
?mdat Box
中被劃分為很多個chunk,這里指出了每個chunk的大小.

?

moov:trak: mdia: minf: stbl: stco

stco: Chunk Offset Box,這也是最重要的box, 指示了每個chunk的開始位置
?
1: 視頻
?entry_count:37
?0x24?0x15d3??0x1aaf??0x1f84??0x2a20??0x35aa??0x404a??0x4c53??0x5705
?0x6470??0x6da6??0x767c??0x8174??0x8d00??0x9725??0xa003??0xa9c9??0xb447?
?0xbfdc?0xcbf7??0xd5b8??0xe4c0??0xf064??0xf7da??0x103ea 0x10e70 0x117ff
?0x1200d 0x126da?0x1328b 0x13bbd 0x14247 0x14973 0x151cd 0x15a0a 0x16272
?0x17770
?
?
2:音頻
?entry_count:65
?0x142b?0x1506??0x192a??0x19f9??0x1ded??0x1ec2??0x289b??0x295e
?0x34d6??0x3eef??0x3fab??0x4ae6??0x4b99??0x5590??0x564d??0x62fa?
?0x63b2??0x6cea?0x7506??0x75be??0x7ff7??0x80b1??0x8b86??0x8c4a?
?0x95aa??0x966f??0x9f49??0xa85d?0xa913??0xb2d8??0xb391??0xbe61?
?0xbf22??0xca84??0xcb3c??0xd509??0xe369??0xe416?0xef00??0xefb9?
?0xf673??0xf728??0x1027f 0x10331 0x10db0 0x11688 0x11744 0x11eb7
?0x11f66 0x12573 0x12624 0x13137 0x131de 0x13b0c 0x140e8 0x14197
?0x1481b 0x148c9?0x1507c 0x15124 0x158b2 0x15966 0x161cb 0x17616
?0x176c6

?

moov:trak: mdia: minf: stbl: smhd

smhd: sound media header
?
:
?balance:0 reserved:0
?
暫時未知語義
?

avcC: AVC descriptor box

avcC: AVC descriptor box非常重要, SPS PPS 都放這 在14496-15定義
?
:
?configurationVersion:1??AVCProfileIndication:66
?profile_compatibility:192?AVCLevelIndication;31
?reserved_1:63??lengthSizeMinusOne:3
?reserved_2:7
?numOfSequenceParameterSets:1 numOfPictureParameterSets:1
?SPS length: 24?//
第一個SPS的長度, 多個SPS可以繼續往下
?PPS length: 4?//
第一個PPS的長度, 多個PPS可以繼續往下

?

?

?

aligned(8) class AVCDecoderConfigurationRecord {?

?unsigned int(8) configurationVersion = 1;?

?unsigned int(8) AVCProfileIndication;?

?unsigned int(8) profile_compatibility;?

?unsigned int(8) AVCLevelIndication; ?

?bit(6) reserved = ‘111111’b;

?unsigned int(2) lengthSizeMinusOne; ?

?bit(3) reserved = ‘111’b;

?unsigned int(5) numOfSequenceParameterSets;?

?for (i=0; i< numOfSequenceParameterSets; ?i++) {?

??unsigned int(16) sequenceParameterSetLength ;?

??bit(8*sequenceParameterSetLength) sequenceParameterSetNALUnit;?

?}?

?unsigned int(8) numOfPictureParameterSets;?

?for (i=0; i< numOfPictureParameterSets; ?i++) {?

??unsigned int(16) pictureParameterSetLength;?

??bit(8*pictureParameterSetLength) pictureParameterSetNALUnit;?

?}?

}

http://www.nhzjj.com/asp/admin/editor/newsfile/201011314552121.pdf

btrt: bit rate box

btrt: bit rate box
?bufferSizeDB:7858?//
告訴decoder開辟緩沖區大小?
?maxBitrate:413432?//
最大Bit rate
?avgBitrate:371960?//
平均Bit rate

?

?avc1

?class AVCSampleEntry() extends VisualSampleEntry (‘avc1’){

?AVCConfigurationBox config;?

?MPEG4BitRateBox (); ? ? ?// optional?

?MPEG4ExtensionDescriptorsBox (); // optional?

}

?

?

class AVCConfigurationBox extends Box(‘avcC’) {?

?AVCDecoderConfigurationRecord() AVCConfig;?

}

?

?

class MPEG4BitRateBox extends Box(‘btrt’){

?unsigned int(32) bufferSizeDB;?

?unsigned int(32) maxBitrate;?

?unsigned int(32) avgBitrate;?

}

?

?

class MPEG4ExtensionDescriptorsBox extends Box(‘m4ds’) {?

?Descriptor Descr[0 .. 255];?

}

?

?

?

:?



Trouble shooting
1,
播放速度不正常, 哪個參數可調?
?mdhd->timescale,
數字越大, 則播放速度越快
?
2,
拖拉不正常, 哪個Box可調?
?stss,
如果只有一條entry, 則拖拉會產生cpu 100%的情況. 如果沒有entry, 則拖拉會略有停頓
3,
音頻,視頻分別整合成mp4文件可以播放, 但音頻,視頻都整合進mp4文件以后就無法播放.
?trak->track_id,
兩軌可能都用同一ID, 則不成. 視頻為1, 音頻為2,則可以解決這個問題

其實以上文章只是個簡單的翻譯,詳細的文檔可參考:

ISO_IEC14496-12_2005(E)

Information technology — Coding of
audio-visual objects —
Part 12:
ISO base media file format
Technologies de l'information — Codage des objets audiovisuels —
Partie 12: Format ISO de base pour les fichiers médias


ISO_IEC14496-14_2003(E)

Information technology — Coding of
audio-visual objects —
Part 14:
MP4 file format
Technologies de l'information — Codage des objets audiovisuels —
Partie 14: Format de fichier MP4

網上比較難于下載到,有需要的朋友可以email:wguizhou2008@gmail.com 找我索要。

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/455341.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/455341.shtml
英文地址,請注明出處:http://en.pswp.cn/news/455341.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

PyQt5案例匯總(簡潔版)

01菜單欄 import sys from PyQt5.QtWidgets import QMainWindow, QAction, qApp, QApplication from PyQt5.QtGui import QIconclass Example(QMainWindow):def __init__(self):super().__init__()self.initUI()def initUI(self):exitAct QAction(QIcon(exit.png), &Exit,…

個人關于浮動的理解

浮動帶來的影響&#xff1a; ①. 能夠讓浮動之后的元素布局產生混亂 &#xff08;元素浮動后脫離了標準文檔流&#xff0c;它的布局也就不再遵循標準文檔流的規則&#xff0c;多個浮動元素在一起的時候就會隨著窗口的變化而變化&#xff0c;也就失去了穩定的布局&#xff09; ②…

接口測試 rest-assured 使用指南

轉載&#xff1a;https://testerhome.com/topics/7060 原文&#xff1a;https://github.com/rest-assured/rest-assured/wiki/Usage本文github地址&#xff1a;https://github.com/RookieTester/rest-assured-doc 注意&#xff0c;如果您正在使用1.9.0或者更早的版本請參考舊文…

python中格式化字符串的作用_python中字符串格式化的意義(化妝)

格式 描述%%百分號標記 #就是輸出一個%%c字符及其ASCII碼%s字符串%d有符號整數(十進制)%u無符號整數(十進制)%o無符號整數(八進制)%x無符號整數(十六進制)%X無符號整數(十六進制大寫字符)%e浮點數字(科學計數法)%E浮點數字(科學計數法&#xff0c;用E代替e)%f浮點數字(用小數點…

MongoDB的快速手動安裝

就是關于MongoDB主從庫的安裝配置和啟動。網上關于MongoDB的安裝有大量的文章供大家學習。我這里提供一個Windows環境下MongoDB主從庫的快速手動安裝的方法&#xff0c;只需要三步即可。 先下載的安裝包&#xff0c;解壓縮后找到bin文件夾&#xff0c;將bin文件夾拷貝至你自己的…

MP4音頻解碼信息

文章轉載自&#xff1a;http://blog.csdn.net/flyingqr/archive/2010/02/02/5282600.aspx 版權歸原作者&#xff0c;編輯&#xff1a;小乙哥 MP4文件格式分為頭部和數據兩部分&#xff0c;頭部是由許多被稱作Atom的結構單元嵌套或排列而成&#xff0c;數據部分則完全為實際數據…

時序圖 分支_UML用例圖

UML用例圖用例圖有以下東東:用例參與者關聯系統邊界用例使用橢圓來表示&#xff0c;橢圓里邊寫上用例的名稱:這里的用例可以理解為一個動作或行為,或者一個對象。參與者用一個小人兒,在小人兒下面寫上參與者名稱,例如學生:關聯用一條線表示:把很多個用例放到一個大的矩形框里。…

Python腳本實現漢子轉拼音

起步 中華文化博大精深&#xff0c;是中華民族的財富&#xff0c;吸收和繼承發揚中 華文化&#xff0c;是現代每個炎黃子孫無可推卸的天職。 今天小編就交大家用python寫一個腳本,實現漢子和拼音之間的轉換 pinyin.py 漢字轉拼音,With Python Example: from pinyin impor…

MySQL innodb_table_stats表不存在的解決方法

在做實驗時&#xff0c;使用mysqldump命令報錯[rootlinux-mysql02 3306]# mysqldump -uroot -p123456 -S /u02/data/3306/mysql.sock -A -B --events | gzip > /opt/rep.sql.gzmysqldump: Got error: 1146: Table mysql.innodb_index_stats doesnt exist when using LOCK TA…

自定義封裝 banner 組件

1. 效果圖預覽 2.基本功能 一個簡單方便的輪播圖組件&#xff0c;基于viewpager 基礎上進行的封裝。可設置 項目中圖片&#xff0c;網絡圖片&#xff0c; View&#xff1b;支持循環自動播放&#xff0c;手勢滑動切換&#xff0c;item點擊事件,可設置 點點的樣式寬高、顏色、大小…

vb.net服務器啟動后cpu占用了70_記一次服務器被異常程序占用的解決過程(懷疑黑客攻擊)...

最近在跑實驗&#xff0c;但是突然發現程序運行變慢&#xff0c;然后top命令查看程序運行情況&#xff0c;發現有異常進程&#xff0c;名字叫 bash&#xff0c;占用 2400% CPU計算資源。剛開始懷疑是挖礦程序&#xff0c;因實驗室網絡IP為教育網公網&#xff0c;懷疑被攻擊&…

3gp文件格式研究 (轉windcao的專欄)

序言 06我開始做3gp文件的播放器,但是關于3gp的文檔太少了也很難找,在網友luxh的幫助下,我終于有了第一份關于3gp文件格式的文檔《ISO/IEC 14496-12&#xff0c;ISO媒體文件格式》.在此真心感謝luxh的貢獻.當然了是英文版的,有文檔就不錯了.為了便于查閱和理解,我把之后陸續找…

Android開發必用工具及其進階途徑

三百六十行&#xff0c;行行出狀元&#xff0c;怎么樣才能在Android行業中當個狀元了&#xff0c;開發過程中的高效、自我能力的提升顯得至關重要&#xff0c;步入IT行業更是要時時刻刻學習&#xff0c;新技術更新快&#xff0c;今天將介紹一下Android開發中必用工具及其進階途…

MySQL遇到check the manual that corresponds to your MySQL server version for the right syntax錯誤

原來是MySQL表中不能包含關鍵字 轉載于:https://www.cnblogs.com/flycoding/p/7088465.html

Python腳本實現圖片加水印

起步 圖片是指由圖形、圖像等構成的平面媒體,有形式的事物&#xff0c;我們看到的&#xff0c;是圖畫、照片、拓片等的統稱。 為了保護一些原創圖片的版權,某些時候我們需要在圖片上面,加上水印,當然你可以用Photoshop來做,只不過如果圖片數量過多,亦或者圖片的動態生成的時候…

yarn 怎么查看有多個job在跑_flink on yarn 模式下提示yarn資源不足問題分析

背景在實時計算平臺上通過YarnClient向yarn上提交flink任務時一直卡在那里&#xff0c;并在client端一直輸出如下日志&#xff1a;(YarnClusterDescriptor.java:1036)- Deployment took more than 60 seconds. Please check if the requested resources are available in the Y…

MPEG-2TS碼流編輯的原理及其應用(轉載

[作者&#xff1a;遼寧電視臺 趙季偉] 在當今數字媒體不斷發展、新媒體業務不斷涌現 的前提下&#xff0c;實踐證明襁褓中的新媒體只有兩種經營方略可供選擇&#xff1a;或是購買并集成整套節目&#xff0c;或是低成本深加工新節目&#xff0c;再不可能去按照傳統生產模式…

Python中的yield詳解

閱讀別人的python源碼時碰到了這個yield這個關鍵字&#xff0c;各種搜索終于搞懂了&#xff0c;在此做一下總結&#xff1a; 通常的for…in…循環中&#xff0c;in后面是一個數組&#xff0c;這個數組就是一個可迭代對象&#xff0c;類似的還有鏈表&#xff0c;字符串&#xf…

shell循環結構之while循環

while循環 1) while CONDITION; dostatementstatement<改變循環條件真假的語句>done 編寫腳本&#xff0c;計算1---100的和 #!/bin/bash#sum0i1while [ $i -le 100 ]; dolet sum$sum$ilet i$i1doneecho $sum2) while true; do statementstatementdone #!/bin/bash#while …

python 管道隊列_關于python:Multiprocessing-管道與隊列

Python的多處理程序包中的隊列和管道之間的根本區別是什么&#xff1f;在什么情況下應該選擇一種&#xff1f; 什么時候使用Pipe()有優勢&#xff1f; 什么時候使用Queue()有優勢&#xff1f;Pipe()只能有兩個端點。Queue()可以有多個生產者和消費者。何時使用它們如果需要兩個…