简体   繁体   English

Fragmented mp4(fMP4) 究竟是什么? 它与普通的mp4有什么不同?

[英]What exactly is Fragmented mp4(fMP4)? How is it different from normal mp4?

Media Source Extension ( MSE ) needs fragmented mp4 for playback in the browser.媒体源扩展 ( MSE ) 需要分段 mp4 才能在浏览器中播放。

A fragmented MP4 contains a series of segments which can be requested individually if your server supports byte-range requests.碎片化的 MP4 包含一系列片段,如果您的服务器支持字节范围请求,则可以单独请求这些片段。

Boxes aka Atoms盒子又名原子

All MP4 files use an object oriented format that contains boxes aka atoms .所有 MP4 文件都使用面向对象的格式,其中包含box aka atom

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 .您可以使用在线工具(例如MP4 Parser)查看 MP4 中框的表示,或者如果您使用的是 Windows,则为MP4 Explorer Let's compare a normal MP4 with one that is fragmented:让我们将普通 MP4 与碎片化的 MP4 进行比较:

Non-Fragmented MP4非碎片 MP4

This screenshot (from MP4 Parser ) shows an MP4 that hasn't been fragmented and quite simply has one massive mdat (Movie Data) box.此屏幕截图(来自MP4 Parser )显示了一个没有碎片化的 MP4,它只有一个巨大的mdat (电影数据)框。

使用 MP4 解析器生成的正常、非碎片化 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.如果我们正在构建支持自适应比特率的视频播放器,我们可能需要知道 0.5Mbps 和 1Mbps 文件中 10 秒标记的字节位置,以便此时在两个文件之间切换视频源。 Determining this exact byte position within one massive mdat in each respective file is not trivial.在每个相应文件中的大量mdat中确定这个确切的字节位置并非易事。

Fragmented MP4碎片化的 MP4

This screenshot shows a fragmented MP4 which has been segmented using MP4Box with the onDemand profile.此屏幕截图显示了已使用MP4BoxonDemand配置文件分段的碎片 MP4。

使用 MP4 解析器生成的碎片 MP4 中框的表示

You'll notice the sidx and series of moof + mdat boxes.您会注意到sidx和一系列moof + mdat框。 The sidx is the Segment Index and stores meta data of the precise byte range locations of the moof + mdat segments. sidx是段索引并存储moof + mdat段的精确字节范围位置的元数据。

Essentially, you can independently load the sidx (its byte-range will be defined in the accompanying .mpd Media Presentation Descriptor file) and then choose which segments you'd like to subsequently load and add to the MSE SourceBuffer .本质上,您可以独立加载sidx (其字节范围将在随附的.mpd媒体演示描述符文件中定义),然后选择您希望随后加载并添加到 MSE SourceBuffer 的片段

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.重要的是,每个片段都是按照您选择的固定间隔(即每 5 秒)创建的,因此片段可以在不同比特率的文件之间进行时间对齐,从而可以轻松地在播放期间调整比特率。

Media File Formats媒体文件格式

Media data streams are wrapped in a container format.媒体数据流以容器格式包装。 The container in- cludes the physical data of the media but also metadata that are neces- sary for playback.容器包括媒体的物理数据以及播放所需的元数据。 For example it signals to the video player the codec used, subtitles tracks etc. In video streaming there are two main formats that are used for storage and presentation of multimedia content: MPEG- 2 Transport Streams (MPEG-2 TS)[25] and ISO Base Media File Formats (ISOBMFF)[24](MP4 and fragmented MP4).例如,它向视频播放器发送使用的编解码器、字幕轨道等信号。在视频流中,有两种主要格式用于存储和呈现多媒体内容:MPEG-2 传输流 (MPEG-2 TS)[25] 和ISO 基础媒体文件格式 (ISOBMFF)[24](MP4 和分段 MP4)。

MPEG-2 Transport Streams are specified by [25] and are designed for broadcasting video through satellite networks. MPEG-2 传输流由 [25] 指定,旨在通过卫星网络广播视频。 However, Apple adopted it for its adaptive streaming protocol making it an important format.然而,Apple 采用它是因为它的自适应流媒体协议使其成为一种重要的格式。 In MPEG-2 TS audio, video and subtitle streams are multiplexed together.在 MPEG-2 TS 中,音频、视频和字幕流被复用在一起。 MP4 and fragmented MP4 (fMP4), are both part of the MPEG-4, Part 12 standard that covers the ISOBMFF. MP4 和分段 MP4 (fMP4) 都是涵盖 ISOBMFF 的 MPEG-4 第 12 部分标准的一部分。 MP4 is the most known multimedia container format and it's widely supported in different operating systems and devices. MP4 是最知名的多媒体容器格式,在不同的操作系统和设备中得到广泛支持。 The structure of an MP4 video file, is shown in figure 2.2a. MP4 视频文件的结构如图 2.2a 所示。 As shown, MP4 consist of different boxes, each with a different function- ality.如图所示,MP4 由不同的盒子组成,每个盒子都有不同的功能。 These boxes are the basic building block of every container in MP4.这些盒子是 MP4 中每个容器的基本构建块。

For example the file type box ('ftyp'), specifies the compatible brands (spe- cifications) of the file.例如文件类型框('ftyp'),指定文件的兼容品牌(规格)。 MP4 files have a Movie Box ('moov') that contains metadata of the media file and sample tables that are important for timing and indexing the media samples ('stbl'). MP4 文件有一个电影框 ('moov'),其中包含媒体文件的元数据和对媒体样本 ('stbl') 计时和索引很重要的样本表。 Also there is a Media Data Box ('mdat') that contains the corresponding samples.还有一个包含相应样本的媒体数据框('mdat')。 In the fragmented con- tainer, shown in figure 2.2b, media samples are interleaved by using Movie Fragment boxes ('moof') which contain the sample table for the specific fragment(mdat box).在分段容器中,如图 2.2b 所示,媒体样本通过使用包含特定片段(mdat 框)的样本表的电影片段框('moof')进行交错。

在此处输入图像描述

Ref: https://repository.tudelft.nl/islandora/object/uuid%3Ae06cde4c-1514-4a8d-90be-7e10eee5aac1参考: https://repository.tudelft.nl/islandora/object/uuid%3Ae06cde4c-1514-4a8d-90be-7e10eee5aac1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM