当前位置:网站首页>Netflix如何利用开源软件打包视频流

Netflix如何利用开源软件打包视频流

2021-06-01 17:03:31 InfoQ

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"italic"},{"type":"color","attrs":{"color":"#333333","name":"user"}},{"type":"strong"}],"text":"本文最初发布于Netflix技术博客,经授权由InfoQ中文站翻译并分享。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在之前的博文中,我们在Netflix的同事解释了"},{"type":"link","attrs":{"href":"https:\/\/netflixtechblog.com\/optimized-shot-based-encodes-for-4k-now-streaming-47b516b10bbb","title":null,"type":null},"content":[{"type":"text","text":"如何优化4K视频流"}]},{"type":"text","text":","},{"type":"link","attrs":{"href":"https:\/\/netflixtechblog.com\/improving-our-video-encodes-for-legacy-devices-2b6b56eec5c9","title":null,"type":null},"content":[{"type":"text","text":"如何改进传统视频流"}]},{"type":"text","text":",以及最近的,"},{"type":"link","attrs":{"href":"https:\/\/netflixtechblog.com\/optimizing-the-aural-experience-on-android-devices-with-xhe-aac-c27714292a33","title":null,"type":null},"content":[{"type":"text","text":"如何使用新的音频编解码器为我们的会员提供更好的听觉体验"}]},{"type":"text","text":"。在所有这些情况下,在通过内容分发网络Open Connect传送之前,我们需要对那些屡获殊荣的电视节目、电影和纪录片(如《王冠》)进行打包,以便可以为我们的会员提供一些关键特性。在这篇文章中,我们将解释这些特性以及我们如何依靠获奖的标准格式和开源软件来实现它们。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"关键打包特性"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在典型的流管道中,打包是在编码之后进行的步骤,如下图所示。编码器的输出是一个字节序列,称为基本流,要对它进行解析需要了解基本的流语法。例如,检测AV1视频流中的帧边界需要能够解析所谓的开放比特流单元(OBU)并识别时间分隔符OBU。但是,在客户端设备上执行的高级操作,例如搜索,则不需要了解基本语法,并且可以从编解码器无关的格式中受益。打包步骤旨在产生这样一种与编解码器无关的字节序列,称为打包格式或容器格式,在某种程度上,无需深入了解编码格式就可以对其进行操作。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.infoq.cn\/resource\/image\/ac\/e0\/ac1260b5017e4542dd64c92ff0270ee0.png","alt":null,"title":"","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"italic"}],"text":"图1:流预备管道的简化架构"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在播放音频、视频和定时文本时,我们应该为会员提供的一个关键功能是同步。在Netflix,我们努力提供一种体验,让你永远不会在听到《王冠》中相应的对话之前,看到英国女王的嘴唇在动。同步是通过信号的基本元素来实现的,比如在打包内容中提供的时钟或时间线、时间戳和时间刻度。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"会员不是简单地从头到尾观看节目。当继续观看《布里奇顿》时,他们会搜索。他们在观看《"},{"type":"text","marks":[{"type":"color","attrs":{"color":"#333333","name":"user"}}],"text":"女王的棋局》时会"},{"type":"text","text":"重放他们最喜欢的棋局。当他们迫不及待地观看"},{"type":"text","marks":[{"type":"color","attrs":{"color":"#333333","name":"user"}}],"text":"《亚森·罗宾》"},{"type":"text","text":"时,他们会跳过介绍和回顾。他们会在观看互动节目《你与荒野》时回放。由于音频或视频压缩技术的性质,播放器不可能从会员想要的地方开始解码流。其底层机制是,播放器必须在流中找到可以开始解码的点,并尽可能快地解码,找到用户的搜索点之开始播放。这是打包的另一个基本特性:信号帧类型,特别是随机接入点。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"当会员的孩子在父母的汽车后座上观看《神偷卡门》时,或者更一般的来说,当网络吞吐量变化时,我们运用了自适应流媒体技术来提供这种网络条件下最佳的观看体验。"},{"type":"link","attrs":{"href":"https:\/\/netflixtechblog.com\/engineering-a-studio-quality-experience-with-high-quality-audio-at-netflix-eaa0b6145f32","title":null,"type":null},"content":[{"type":"text","text":"自适应流媒体技术"}]},{"type":"text","text":"要求在对各种质量的流进行编码时遵循共同的约束条件,但它们也依赖于打包的另一个关键特性“索引”来提供无缝的质量切换。索引让播放器可以只获取新流的相应片段。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"我们在打包的内容中提供了许多其他的信号元素,以期让会员可以尽快开始观看。解密模块需要用合适的方案和初始化向量进行初始化。硬件视频解码器需要提前知道视频流的分辨率和位深,以便分配解码缓冲区。渲染管道需要提前知道音频流的扬声器配置,或者视频流是HDR还是SDR。能够标记所有这些元素也是现代打包格式的一个关键特性。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"标准和开源软件的作用"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"我们的2亿多会员在各种各样的设备上观看Netflix,从智能手机到笔记本电脑,再到电视和由大量合作伙伴开发的许多其他设备。我们要减少在新设备上播放的阻力,并确保我们的内容在很长一段时间内可以在旧设备上播放,这非常重要。标准在这里发挥了关键性的作用。ISO基本媒体文件格式(ISOBMFF)是娱乐行业的关键打包标准,最近获得了美国国家电视艺术与科学学院(NATAS)颁发的"},{"type":"link","attrs":{"href":"https:\/\/theemmys.tv\/tech-72nd-award-recipients\/","title":null,"type":null},"content":[{"type":"text","text":"技术与工程艾美奖"}]},{"type":"text","text":"。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"ISOBMFF提供了上面提到的所有关键打包特性,而且历史已经证明,它是通用且可扩展的,它具备添加新信号特性和编解码器支持的能力。使用成熟编解码器(如AVC和AAC)编码的流可以通过ISOBMFF文件传输,但该规范也会定期扩展,以支持最新的编解码器。Netflix的媒体系统团队积极致力于ISOBMFF的开发、维护和采用。例如,Netflix主导了"},{"type":"link","attrs":{"href":"https:\/\/aomediacodec.github.io\/av1-isobmff\/","title":null,"type":null},"content":[{"type":"text","text":"ISOBMFF中AOM AV1视频流的传输规范"}]},{"type":"text","text":"。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"经过20多年的发展,ISOBMFF为各种用例积累了大量的技术工具。图2通过“brand”的概念说明了现如今ISOBMFF的复杂性,这个概念类似于音频或视频标准中的配置文件。最初,该标准有限且可以良好地嵌套,但现在已经非常广泛,并向各个方向发展。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.infoq.cn\/resource\/image\/59\/37\/59c9585ac3ee2e201440f022e2197637.png","alt":null,"title":"","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"italic"}],"text":"图2:说明ISOBMFF第6版的复杂性。每个矩形代表一个“brand”(由粗体的四字符代码表示)和它所需的工具集(由“+”号行表示)。Brand是嵌套的。所有内层brand的工具都是外层brand所需要的。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"对于Netflix的流媒体服务,我们依赖于由公共媒体应用程序格式(CMAF)标准确定的这些工具的一个子集,以及公共加密(CENC)标准中定义的内容保护工具。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"像ISOBMFF、CMAF和CENC这样的多媒体标准都有相应的开源软件实现。开源软件可以示范该标准的特性,使行业了解其好处并扩大其采用范围。开源软件还可以通过中立的参考实现来突出可能存在的歧义条款,从而帮助提高标准的质量。Netflix的媒体系统团队为SMPTE IMF标准维护了一个名为"},{"type":"link","attrs":{"href":"https:\/\/github.com\/Netflix\/photon","title":null,"type":null},"content":[{"type":"text","text":"Photon"}]},{"type":"text","text":"的开源参考实现。对于ISOBMFF, Netflix使用了来自"},{"type":"link","attrs":{"href":"http:\/\/gpac.io\/","title":null,"type":null},"content":[{"type":"text","text":"GPAC团队"}]},{"type":"text","text":"的开源参考实现"},{"type":"link","attrs":{"href":"https:\/\/github.com\/gpac\/gpac\/wiki\/MP4Box","title":null,"type":null},"content":[{"type":"text","text":"MP4Box"}]},{"type":"text","text":"。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在这个由标准和开源软件组成的打包生态系统中,媒体系统团队的工作包括从现有标准中找出工具来解决新的流媒体用例。当这样的工具不存在时,我们就定义新的标准或扩展现有的标准,包括ISOBMFF和CMAF,并支持开源软件来匹配这些标准。例如,当我们的视频编码同事设计了动态优化的编码方案,用于制作具有可变时长的流片段,我们修改了工作流程,以确保具有不同比特率的视频流段在时间上保持一致。类似地,当我们的音频编码同事引入xHE-AAC时(这就打破了以前每个音频帧都可解码的假设),也就保证了音频\/视频片段的一致性。最后,当我们希望帮助业界汇聚到一种用于新视频编解码器(如AV1)的通用加密方案时,我们就协调讨论选出方案,这里是基于模式的子样本加密(简称“cbcs”),并通过提供参考位流作出示范。当然,我们的工作也包括在在没有适当标准支持的领域处理许多类型的设备。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"小结"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"我们希望这篇文章能让你更好地了解Netflix媒体系统团队的部分工作,希望下次你观看我们的获奖节目时,会发现ISOBMFF所发挥的作用,这是一项关键的获奖技术。感兴趣的话,你可以了解下这个团队其他方面的工作,看看其他获奖的技术,比如"},{"type":"link","attrs":{"href":"https:\/\/theemmys.tv\/tech-67th-award-recipients\/","title":null,"type":null},"content":[{"type":"text","text":"TTML"}]},{"type":"text","text":","},{"type":"link","attrs":{"href":"https:\/\/netflixtechblog.com\/implementing-japanese-subtitles-on-netflix-c165fbe61989","title":null,"type":null},"content":[{"type":"text","text":"我们用它来制作日语字幕"}]},{"type":"text","text":"。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"查看英文原文:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https:\/\/netflixtechblog.com\/packaging-award-winning-shows-with-award-winning-technology-c1010594ba39","title":null,"type":null},"content":[{"type":"text","text":"Packaging award-winning shows with award-winning technology"}]}]}]}

版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢
https://www.infoq.cn/article/vgeSMelaCjuadyJp7Olu?utm_source=rss&utm_medium=article

随机推荐