如何使用 Azure 媒体服务 v3 从 .mp3(或其他纯音频)文件编码的 .mp4 生成空或空白视频层?
How to generate empty or blank videolayer to .mp4 which is encoded from .mp3 (or other audio-only) files using Azure Media Services v3?
问题总结
我们使用 Azure Media Services v3 通过 Azure Media Player 流媒体文件。目前我正在尝试添加一个选项来使用 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.
我试过的
所以我尝试将 blank/empty h264Layer 添加到转换作业中,这样编码文件就不会只有音频了。我发现了一些关于此问题的问题,like this,但我的问题仍未解决。
我还找到了 this suggestion,这使我进入了 Azure 媒体服务 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 流式传输的任何类型的文件。我想这应该通过向编码文件添加 blank/empty H264 层来实现,但我不知道如何在 Azure 媒体服务 v3 中做到这一点。
将离线传送的响应添加到此 post:
- 你是对的,Azure Media Player 当前需要一个视频
曲目
- 使用 v2 API 时,可以在编码纯音频源时插入视频轨道
- 该标志当前未在我们的 v3 架构中公开
但是,应该能够使用像 AdaptiveStreaming 这样的 v3 预设——它对音频进行编码,并生成“空白视频”轨道
谢谢,
阿尼尔
问题总结
我们使用 Azure Media Services v3 通过 Azure Media Player 流媒体文件。目前我正在尝试添加一个选项来使用 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.
我试过的
所以我尝试将 blank/empty h264Layer 添加到转换作业中,这样编码文件就不会只有音频了。我发现了一些关于此问题的问题,like this,但我的问题仍未解决。 我还找到了 this suggestion,这使我进入了 Azure 媒体服务 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 流式传输的任何类型的文件。我想这应该通过向编码文件添加 blank/empty H264 层来实现,但我不知道如何在 Azure 媒体服务 v3 中做到这一点。
将离线传送的响应添加到此 post:
- 你是对的,Azure Media Player 当前需要一个视频 曲目
- 使用 v2 API 时,可以在编码纯音频源时插入视频轨道
- 该标志当前未在我们的 v3 架构中公开
但是,应该能够使用像 AdaptiveStreaming 这样的 v3 预设——它对音频进行编码,并生成“空白视频”轨道
谢谢,
阿尼尔