简体   繁体   English

Windows Azure Media Services动态打包-如何在HLS中更改流顺序?

[英]Windows Azure Media Services dynamic packaging - how to change stream order in HLS?

(TLDR summary: I need a way to adjust the initial stream in the m3u8 file produced by Azure Media Services dynamic packaging, on a per-request basis. ) (TLDR摘要: 我需要一种方法,可以根据每个请求调整由Azure Media Services动态打包产生的m3u8文件中的初始流。

Currently I have a lot of assets which I use dynamic packaging to access. 目前,我有很多资产,可以使用动态打包来访问。 I am using Adaptive Bit Rate streaming, so the asset container contains 8 streams of various quality, and the dynamic packaging is putting together an m3u8 playlist using a url ending in "{...}.ism/Manifest(format=m3u8-aapl)" . 我正在使用自适应比特率流式传输,因此资产容器包含8个质量各异的流,动态打包使用m3u8播放列表(网址以“ {....... ism / Manifest(format = m3u8-aapl )”。 This does ALMOST exactly what I need. 这确实满足了我的需求。

I am encoding with custom XML which is basically the H264AdaptiveBitrateMP4Set720p configuration, but with auto rotation enabled. 我正在使用自定义XML进行编码,该XML基本上是H264AdaptiveBitrateMP4Set720p配置,但是启用了自动旋转。 This has encoded files of bitrates from as high as 3400 down to 400 (plus 2 audio files). 它已将比特率的文件编码从3400降低到400(加上2个音频文件)。

Here is the problem: I am delivering to an iOS app via adaptive bitrate streaming. 这是问题所在:我正在通过自适应比特率流媒体将其交付给iOS应用。 Many videos are 5-15 seconds. 许多视频都是5到15秒。 It usually takes 10 seconds of playback at the initial bitrate to auto-adjust to a stream appropriate to the connection. 以初始比特率播放通常需要10秒,才能自动调整为适合该连接的流。 However, because most videos are so short, the majority of every playback is at extremely low quality, with no way for users to stream the higher quality version even when on fast connections. 但是,由于大多数视频都很短,因此每次播放的大部分视频质量都非常低,即使处于快速连接状态下,用户也无法流式传输更高质量的版本。

I've determined that this is because iOS automatically takes the first stream listed from the m3u8 file as its initial quality. 我确定这是因为iOS自动将m3u8文件中列出的第一个流作为其初始质量。 Azure Media Services dynamic packaging puts the lowest bitrate stream first in the m3u8 list. Azure Media Services动态打包将最低比特率的流放在m3u8列表中。 Therefore, the device always starts playback of the lowest quality stream. 因此,设备始终会开始播放质量最低的流。 In our use case, this can be problematic. 在我们的用例中,这可能是有问题的。

The solution I want to take is to put some intelligence in the client about guessing at the initial speed desired (device on wifi could start at higher if not highest quality, device on cell can start at lower or lowest, and we can monitor and adjust initial bitrate based on last detected speed/quality. 我要采取的解决方案是在客户端中添加一些智能,以猜测所需的初始速度(如果不是高质量的话,wifi上的设备可以以更高的速度启动,单元上的设备可以以较低或最低的速度启动,并且我们可以监视和调整基于上次检测到的速度/质量的初始比特率。

To accomplish that, I need a way to adjust the initial stream in the m3u8 file produced by Azure Media Services dynamic packaging, on a per-request basis. 为此,我需要一种在每个请求的基础上调整由Azure Media Services动态打包产生的m3u8文件中的初始流的方法。 Apple proposes having multiple master files, but this isn't DIRECTLY possible with dynamic packaging, but it seems to be capable of the idea abstractly. 苹果公司提出要有多个主文件,但是动态打包不可能直接实现,但是似乎可以抽象地实现这个想法。 However, I have been trying to figure out HOW to pass in url criteria to select the initial somehow, and the closest I have found is to create a filter (eg .ism/Manifest(format=m3u8-aapl, filter=MyFilter) )... however, that seems to only allow you to limit the streams available, not simply re-order them (or really, just move a specific one to the top based on some criteria). 但是,我一直试图找出如何通过url标准来选择初始方式,而我发现的最接近的方法是创建一个过滤器(例如.ism / Manifest(format = m3u8-aapl,filter = MyFilter)) ...但是,这似乎仅允许您限制可用的流,而不仅仅是对它们进行重新排序(或者实际上,只是根据某些条件将特定的流移到顶部)。 I'm SOOO close to getting what I need, but am missing some key detail. 我很快就可以满足需要,但是缺少一些关键细节。

I'm curious if it is possible and I'm just missing it, or if it is a limitation I'll have to find another solution around? 我很好奇是否有可能,但我只是想念它,或者如果这是一个局限性,我将不得不寻找其他解决方案? I could fall back to static packaging (which would be a pain to update all the existing content), but beyond the tedious conversion, it is apparently deprecated and will be turned off soon, so that may not even be a real option. 我可能会退回到静态包装(要更新所有现有内容会很痛苦),但是除了繁琐的转换之外,它显然已被弃用,并且很快将被关闭,因此,这甚至不是真正的选择。

Thoughts or ideas? 有想法或想法吗?

Thanks! 谢谢!

(Update 2016-01-20 to add clarity): Basically, this is an example of the m3u8 file result from the HLS dynamic packaging of one of my videos: (更新说明2016-01-20以增加清晰度):基本上,这是我的一个视频的HLS动态打包产生的m3u8文件结果的示例:

#EXTM3U
#EXT-X-VERSION:4
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="AAC_und_ch2_96kbps",URI="QualityLevels(93571)/Manifest(AAC_und_ch2_96kbps,format=m3u8-aapl)"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="AAC_und_ch2_56kbps",DEFAULT=YES,URI="QualityLevels(53646)/Manifest(AAC_und_ch2_56kbps,format=m3u8-aapl)"
#EXT-X-STREAM-INF:BANDWIDTH=508030,RESOLUTION=240x180,CODECS="avc1.4d400d,mp4a.40.2",AUDIO="audio"
QualityLevels(387555)/Manifest(video,format=m3u8-aapl)
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=508030,RESOLUTION=240x180,CODECS="avc1.4d400d",URI="QualityLevels(387555)/Manifest(video,format=m3u8-aapl,type=keyframes)"
#EXT-X-STREAM-INF:BANDWIDTH=762407,RESOLUTION=480x360,CODECS="avc1.4d4015,mp4a.40.2",AUDIO="audio"
QualityLevels(636456)/Manifest(video,format=m3u8-aapl)
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=762407,RESOLUTION=480x360,CODECS="avc1.4d4015",URI="QualityLevels(636456)/Manifest(video,format=m3u8-aapl,type=keyframes)"
#EXT-X-STREAM-INF:BANDWIDTH=1104186,RESOLUTION=480x360,CODECS="avc1.4d401e,mp4a.40.2",AUDIO="audio"
QualityLevels(970878)/Manifest(video,format=m3u8-aapl)
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=1104186,RESOLUTION=480x360,CODECS="avc1.4d401e",URI="QualityLevels(970878)/Manifest(video,format=m3u8-aapl,type=keyframes)"
#EXT-X-STREAM-INF:BANDWIDTH=1603625,RESOLUTION=720x540,CODECS="avc1.4d401e,mp4a.40.2",AUDIO="audio"
QualityLevels(1459566)/Manifest(video,format=m3u8-aapl)
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=1603625,RESOLUTION=720x540,CODECS="avc1.4d401e",URI="QualityLevels(1459566)/Manifest(video,format=m3u8-aapl,type=keyframes)"
#EXT-X-STREAM-INF:BANDWIDTH=2316919,RESOLUTION=720x540,CODECS="avc1.4d401e,mp4a.40.2",AUDIO="audio"
QualityLevels(2157505)/Manifest(video,format=m3u8-aapl)
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=2316919,RESOLUTION=720x540,CODECS="avc1.4d401e",URI="QualityLevels(2157505)/Manifest(video,format=m3u8-aapl,type=keyframes)"
#EXT-X-STREAM-INF:BANDWIDTH=3444678,RESOLUTION=960x720,CODECS="avc1.4d4020,mp4a.40.2",AUDIO="audio"
QualityLevels(3260988)/Manifest(video,format=m3u8-aapl)
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=3444678,RESOLUTION=960x720,CODECS="avc1.4d4020",URI="QualityLevels(3260988)/Manifest(video,format=m3u8-aapl,type=keyframes)"
#EXT-X-STREAM-INF:BANDWIDTH=62986,CODECS="mp4a.40.2",AUDIO="audio"
QualityLevels(53646)/Manifest(AAC_und_ch2_56kbps,format=m3u8-aapl)

And I want to move one of the mid-quality streams to the top of that list (PER request.. ie devices on cell should use the above list, but devices on wireless should use this list): 我想将其中一个中等质量的流移动到该列表的顶部(PER请求..即,单元上的设备应使用以上列表,而无线设备上的设备应使用此列表):

#EXTM3U
#EXT-X-VERSION:4
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="AAC_und_ch2_96kbps",URI="QualityLevels(93571)/Manifest(AAC_und_ch2_96kbps,format=m3u8-aapl)"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="AAC_und_ch2_56kbps",DEFAULT=YES,URI="QualityLevels(53646)/Manifest(AAC_und_ch2_56kbps,format=m3u8-aapl)"
#EXT-X-STREAM-INF:BANDWIDTH=1104186,RESOLUTION=480x360,CODECS="avc1.4d401e,mp4a.40.2",AUDIO="audio"
QualityLevels(970878)/Manifest(video,format=m3u8-aapl)
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=1104186,RESOLUTION=480x360,CODECS="avc1.4d401e",URI="QualityLevels(970878)/Manifest(video,format=m3u8-aapl,type=keyframes)"
#EXT-X-STREAM-INF:BANDWIDTH=508030,RESOLUTION=240x180,CODECS="avc1.4d400d,mp4a.40.2",AUDIO="audio"
QualityLevels(387555)/Manifest(video,format=m3u8-aapl)
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=508030,RESOLUTION=240x180,CODECS="avc1.4d400d",URI="QualityLevels(387555)/Manifest(video,format=m3u8-aapl,type=keyframes)"
#EXT-X-STREAM-INF:BANDWIDTH=762407,RESOLUTION=480x360,CODECS="avc1.4d4015,mp4a.40.2",AUDIO="audio"
QualityLevels(636456)/Manifest(video,format=m3u8-aapl)
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=762407,RESOLUTION=480x360,CODECS="avc1.4d4015",URI="QualityLevels(636456)/Manifest(video,format=m3u8-aapl,type=keyframes)"
#EXT-X-STREAM-INF:BANDWIDTH=1603625,RESOLUTION=720x540,CODECS="avc1.4d401e,mp4a.40.2",AUDIO="audio"
QualityLevels(1459566)/Manifest(video,format=m3u8-aapl)
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=1603625,RESOLUTION=720x540,CODECS="avc1.4d401e",URI="QualityLevels(1459566)/Manifest(video,format=m3u8-aapl,type=keyframes)"
#EXT-X-STREAM-INF:BANDWIDTH=2316919,RESOLUTION=720x540,CODECS="avc1.4d401e,mp4a.40.2",AUDIO="audio"
QualityLevels(2157505)/Manifest(video,format=m3u8-aapl)
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=2316919,RESOLUTION=720x540,CODECS="avc1.4d401e",URI="QualityLevels(2157505)/Manifest(video,format=m3u8-aapl,type=keyframes)"
#EXT-X-STREAM-INF:BANDWIDTH=3444678,RESOLUTION=960x720,CODECS="avc1.4d4020,mp4a.40.2",AUDIO="audio"
QualityLevels(3260988)/Manifest(video,format=m3u8-aapl)
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=3444678,RESOLUTION=960x720,CODECS="avc1.4d4020",URI="QualityLevels(3260988)/Manifest(video,format=m3u8-aapl,type=keyframes)"
#EXT-X-STREAM-INF:BANDWIDTH=62986,CODECS="mp4a.40.2",AUDIO="audio"
QualityLevels(53646)/Manifest(AAC_und_ch2_56kbps,format=m3u8-aapl)

Note how these are essentially the SAME lists, except in the second one, the first STREAM listed is the 1104186 bitrate one, where in the second, it is the higher 508030 bitrate one, which iOS assumes is the initial quality (which it will upgrade or degrade from). 请注意,它们实际上是SAME列表,但在第二个列表中,第一个STREAM列出的是1104186比特率,而在第二个列表中是较高的508030比特率,iOS假定这是初始质量(它将升级)或从中降级)。 This way, short 6 second videos will not be insanely poor quality on high-speed connections... ideally, the device could note which bitrate it was last capable of and request an even higher initial (but still have the full list in the m3u8 so it could degrade as needed) 这样一来,短短的6秒视频在高速连接上就不会出现质量差的问题……理想情况下,设备可以记录其最后一次可以使用的比特率,并请求更高的初始比特率(但在m3u8中仍然有完整列表)因此它可能会根据需要降级)

Have you tried to restrict track? 您是否尝试限制轨道? Or you could use AMP to set different heuristic profile: either fast start or high quality. 或者,您可以使用AMP设置不同的启发式配置文件:快速启动或高质量。 Please refer to the samples here: https://amp.azure.net/libs/amp/latest/samples/dynamic_heuristicsProfile.html . 请在此处参考示例: https : //amp.azure.net/libs/amp/latest/samples/dynamic_heuristicsProfile.html

Cheers, Mingfei Yan 干杯,严明飞

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

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