问题总结
我们使用 Azure 媒体服务 v3 和 Azure 媒体播放器来流媒体文件。目前我正在尝试添加一个选项来使用 AES 加密传输 .mp3。 上传和编码文件工作正常,我可以看到生成的 .mp4 文件,如果我从 blob 下载它,我什至可以播放它。问题是当我尝试在 Azure Media Player 中对其进行流式传输时,我在播放器中收到以下错误: image 这是因为 Azure Media Player 不支持仅流式传输音频文件,如其 documentation 中所述。 :
May work in some techs for Adaptive Streaming but is currently not supported and does not work in AzureHtml5JS.
我尝试过的
因此,我尝试将空白/空 h264Layer 添加到转换作业中,以便编码文件不再是纯音频文件。我发现了一些关于这个问题的问题,like this ,但是我的问题仍然没有解决。 我还发现了this suggestion ,这使我进入了 Azure Media Services v2 文档页面,但我认为这不是我需要的。 我也看到过这个注释:
Many of the advanced Media Services v2 features of the Media Encoder Standard are currently not available in v3. For more information, see feature gaps.
我将编码预设设置为“EncoderNamedPreset.AACGoodQualityAudio”。然后到“EncoderNamedPreset.H264SingleBitrate720p”只是为了看看它是否创建了一个空的视频层,但结果是相同的:视频文件是在其自己的资源中创建的,但我无法流式传输它。
我尝试使用空的 H264Layer 创建自己的编码器预设,如下所示:
new StandardEncoderPreset(
codecs: new Codec[]
{
new AacAudio(
channels: 2,
samplingRate: 48000,
bitrate: 128000,
profile: AacAudioProfile.AacLc
),
new H264Video(
keyFrameInterval: TimeSpan.FromSeconds(2),
sceneChangeDetection: true,
layers: new H264Layer[]
{
new H264Layer (
bitrate: 1, // Units are in bits per second
width: "1",
height: "1",
label: "SD" // This label is used to modify the file name in the output formats
) }
)
},
formats: new Format[]
{
new Mp4Format(filenamePattern:"Video-{Basename}-{Label}-{Bitrate}{Extension}")
}
)
创建转换时的结果:
Exception: Operation returned an invalid status code 'BadRequest'
有空白层
new H264Layer (
bitrate: 0, // Units are in bits per second
width: "0",
height: "0",
label: "SD" // This label is used to modify the file name in the output formats
)
创建转换时的结果:
Exception: Operation returned an invalid status code 'BadRequest'
没有构造函数参数的 H264Layer
new H264Layer()
结果: 变换已创建。 尝试流式传输时,AMP 中出现同样的错误。
The video playback was aborted due to a corruption problem or because the video used features your browser did not support. (0x20400003)
预期结果
预期结果是 Azure Media Player 可以流式传输的任何类型的文件。我想这应该通过在编码文件中添加空白/空 H264 层来实现,但我不知道如何在 Azure 媒体服务 v3 中执行此操作。
最佳答案
将离线传送的回复添加到此帖子:
- 您是对的,Azure Media Player 目前需要视频 跟踪
- 使用 v2 API 时,可以在对纯音频源进行编码时插入视频轨道
- 该标志目前未在我们的 v3 架构中公开
但是,应该能够使用像 AdaptiveStreaming 这样的 v3 预设 - 它对音频进行编码,并生成“空白视频”轨道
谢谢
安尼尔
关于c# - 如何使用 Azure 媒体服务 v3 将空或空白的 videolayer 生成为从 .mp3(或其他纯音频)文件编码的 .mp4?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55816344/