A fragmented MP4 contains a series of segments which can be requested individually if your server supports byte-range requests.
fMP4格式的文件中,包含多个segments,这些segment可以被单独请求(如果服务器支持按字节进行读取的请求的话)。
Boxes aka Atoms
All MP4 files use an object oriented format that contains boxes aka atoms.
You can view a representation of the boxes in your MP4 using an online tool such as MP4 Parser or if you're using Windows, MP4 Explorer. Let's compare a normal MP4 with one that is fragmented:
Non-Fragmented MP4
This screenshot (from MP4 Parser) shows an MP4 that hasn't been fragmented and quite simply has one massive
mdat(Movie Data) box.
Non-Fragmented MP4
If we were building a video player that supports adaptive bitrate, we might need to know the byte position of the 10 sec mark in a 0.5Mbps and a 1Mbps file in order to switch the video source between the two files at that moment. Determining this exact byte position within one massivemdatin each respective file is not trivial.
Non-Fragmented MP4包含一个特别大的mdat (Movie Data) box。
Fragmented MP4
This screenshot shows a fragmented MP4 which has been segmented using MP4Box with the
onDemandprofile.
fragmented MP4基于MP4Box的点播profile进行切割。
You'll notice the
sidxand series ofmoof+mdatboxes.
Thesidxis the Segment Index and stores meta data of the precise byte range locations of themoof+mdatsegments.
包含一个sidx和多个moof+mdat。
sidx是segment的索引,并且存储了moof+mdat segments的精确字节范围。
Essentially, you can independently load the
sidx(its byte-range will be defined in the accompanying.mpdMedia Presentation Descriptor file) and then choose which segments you'd like to subsequently(随后) load and add to the MSE SourceBuffer.
开发者可以首先独立加载sidx(它的字节范围可以在一起的.mpd中定义)。
然后确定加载那个segment,并添加到MSE。
Importantly, each segment is created at a regular interval of your choosing (ie. every 5 seconds), so the segments can have temporal(时间的) alignment across files of different bitrates, making it easy to adapt the bitrate during playback.
每个segment按照指定的时长进行创建(比如5秒),所以segments可以在不同比特率的文件之间进行时间对齐,这样的话,码率自适应就变得很容易。

