MP4檔案Boxes的層次結構

2021-07-22 14:19:49 字數 3984 閱讀 5351

mp4檔案的基本組成單元是box,也就是說mp4檔案是由各種各樣的box組成的,有parent box,還有children box。因此,這些boxes之間存在一定的層次關係,總結如下表所示,表中標記出了各個box必選或可選特性,√代表box必選。

ftyp

√ file type and compatibility

pdin

progressive download information

moov

√ container for all the metadata

mvhd

√ movie header, overall declarations

trak

√ container for an individual track or stream

tkhd

√ track header, overall information about the track

tref

track reference container

edts

edit list container

elst

an edit list

mdia

√ container for the media information in a track

mdhd

√ media header, overall information about the media

hdlr

√ handler, declares the media (handler) type

minf

√ media information container

vmhd

video media header, overall information (video track only)

smhd

sound media header, overall information (sound track only)

hmhd

hint media header, overall information (hint track only)

nmhd

null media header, overall information (some tracks only)

dinf

√ data information box, container

dref

√ data reference box, declares source(s) of media data in track

stbl

√ sample table box, container for the time/space map

stsd

√ sample descriptions (codec types, initialization etc.)

stts

√  (decoding) time-to-sample

ctts

(composition) time to sample

stsc

√ sample-to-chunk, partial data-offset

information

stsz

sample sizes (framing)

stz2

compact sample sizes (framing)

stco

√ chunk offset, partial data-offset information

co64

64-bit chunk offset

stss

sync sample table (random access points)

stsh

shadow sync sample table

padb

sample padding bits

stdp

sample degradation priority

sdtp

independent and disposable samples

sbgp

sample-to-group

sgpd

sample group description

subs

sub-sample information

mvex

movie extends box

mehd

movie extends header box

trex

√ track extends defaults

ipmc

ipmp control box

moof

movie fragment

mfhd

√ movie fragment header

traf

track fragment

tfhd

√ track fragment header

trun

track fragment run

sdtp

independent and disposable samples

sbgp

sample-to-group

subs

sub-sample information

mfra

movie fragment random access

tfra

track fragment random access

mfro

√ movie fragment random access offset

mdat

media data container

free

free space

skip

free space

udta

user-data

cprt

meta

metadata

hdlr

√ handler, declares the metadata (handler) type

dinf

data information box, container

dref

data reference box, declares source(s) of metadata items

ipmc

ipmp control box

iloc

item location

ipro

item protection

sinf

protection scheme information box

frma

original format box

imif

ipmp information box

schm

scheme type box

schi

scheme information box

iinf

item information

xmlxml container

bxml

binary xml container

pitm

primary item reference

fiin

file delivery item information

paen

partition entry

fpar

file partition

fecr

fec reservoir

segr

file delivery session group

gitn

group id to name

tsel

track selection

meco

additional metadata container

mere

metabox relation

MP4檔案格式的解析,以及MP4檔案的分割演算法

應用中,更是費盡了心思,主要問題是處理mp4檔案龐大的 頭 當然,畢竟mp4才是h.264最佳的儲存格式嘛。這篇文章先簡單介紹一下mp4檔案的大體結構,以及它的分割演算法,之後再寫文章介紹如何把mp4完美應用在點播專案中。一 mp4格式分析 mp4或mpeg 4 part 2 編碼的音訊。mp4格式...

MP4檔案格式的解析,以及MP4檔案的分割演算法

這幾天整理並重構了一下mp4檔案的解析程式,融合了分解與合併的程式,以前是c語言寫的,應用在linux上執行的伺服器程式上,現在改成c 方便我在其他專案中使用它,至於用不用移植乙份c 的,暫時用不到,等有必要了再說吧。這篇文章先簡單介紹一下mp4檔案的大體結構,以及它的分割演算法,之後再寫文章介紹如...

獲取mp4檔案資訊

計算電影長度 方法1從mvhd movie header atom中找到time scale和duration,duration除以time scale即是整部電影的長度。time scale相當於定義了標準的1秒在這部電影裡面的刻度是多少。例如audio track的time scale 8000...