片段mp4(fMP4)到底是什么?与一般的mp4有何不同? [英] What exactly is Fragmented mp4(fMP4)? How is it different from normal mp4?

查看:1382
本文介绍了片段mp4(fMP4)到底是什么?与一般的mp4有何不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Media Source Extension( MSE )需要分段的mp4才能在浏览器中播放.

Media Source Extension (MSE) needs fragmented mp4 for playback in the browser.

推荐答案

碎片化的MP4包含一系列分段,如果您的服务器支持字节范围请求,则可以单独请求这些分段.

A fragmented MP4 contains a series of segments which can be requested individually if your server supports byte-range requests.

所有MP4文件都使用面向对象的格式,该格式包含又名原子"框.

All MP4 files use an object oriented format that contains boxes aka atoms.

您可以使用在线工具(例如 MP4解析器)查看MP4中框的表示形式,或者重新使用Windows, MP4 Explorer .让我们将普通的MP4与零散的MP4进行比较:

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:

此屏幕截图(来自 MP4解析器)显示了一个MP4,它没有被分割,只是一个巨大的mdat(电影数据)框.

This screenshot (from MP4 Parser) shows an MP4 that hasn't been fragmented and quite simply has one massive mdat (Movie Data) box.

如果我们要构建一个支持自适应比特率的视频播放器,则可能需要知道0.5Mbps和1Mbps文件中10秒标记的字节位置,以便在此时在两个文件之间切换视频源.确定每个文件中一个大块mdat内的确切字节位置并非易事.

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 massive mdat in each respective file is not trivial.

此屏幕截图显示了碎片化的MP4,该碎片已使用 MP4Box onDemand个人资料.

This screenshot shows a fragmented MP4 which has been segmented using MP4Box with the onDemand profile.

您会注意到sidx和一系列 moof + mdat 框. sidx是段索引,用于存储moof + mdat段的精确字节范围位置的元数据.

You'll notice the sidx and series of moof+mdat boxes. The sidx is the Segment Index and stores meta data of the precise byte range locations of the moof+mdat segments.

本质上,您可以独立加载sidx(其字节范围将在随附的.mpd Media Presentation Descriptor文件中定义),然后选择要随后加载并添加到MSE的段 SourceBuffer .

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.

重要的是,每个片段都是以您选择的固定间隔(即每5秒)创建的,因此片段可以在具有不同比特率的文件之间进行时间对齐,从而可以轻松地在播放过程中调整比特率.

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.

这篇关于片段mp4(fMP4)到底是什么?与一般的mp4有何不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆