【发布时间】:2020-01-23 12:44:33
【问题描述】:
我们正在使用 Azure Media Services V3 API 将各种输入格式的视频文件转码为 mp4 输出。如果我们有一个 mxf 输入文件,我们在尝试使用音频编解码器“CopyAudio”对视频进行转码时收到以下异常):Azure Media ReEncode 错误消息:发生错误。阶段:ApplyEncodeCommand。代码:0x00000001。
这与此处提到的相同问题 (Copy audio codec throws exception when transcoding mxf video file),但针对 Azure 媒体服务的 v2 API
那里给出的答案确实是 Azure 媒体服务 v2 的解决方案。 不过,我在将其移植到 v3 API 时遇到了麻烦。在代码中,我们正在创建一个 StandardEncoderPreset (Microsoft.Azure.Management.Media.Models.StandardEncoderPreset) 实例并尝试使用 CopyAudio 编解码器。目前我无法弄清楚如何在那里指定 MOVFormat。
StandardEncoderPreset preset = new StandardEncoderPreset(
codecs: new List<Codec>()
{
new H264Video
{
KeyFrameInterval = TimeSpan.FromSeconds(2),
SceneChangeDetection = true,
//PreserveResolutionAfterRotation = true,
Layers = new[]
{
new H264Layer
{
Profile = H264VideoProfile.Auto,
Level = "Auto",
Bitrate = bitrate,
MaxBitrate = bitrate,
BufferWindow = TimeSpan.FromSeconds(5),
Width = width.ToString(),
Height = height.ToString(),
BFrames = 3,
ReferenceFrames = 3,
FrameRate = "0/1",
AdaptiveBFrame = true
}
}
}, new CopyAudio()
},
// Specify the format for the output files - one for video+audio, and another for the thumbnails
formats: new List<Format>()
{
new Mp4Format()
{
FilenamePattern = "{Basename}_" + width + "x" + height +"_{Bitrate}.mp4"
}
}
使用这样配置的预设,我得到了与原始帖子中提到的相同的错误。 CopyAudio 只有一个属性“标签”。 也一直在想我们需要在“格式”列表中指定一个额外的格式,但我找不到 MOVFormat(或 PCMFormat)类。
【问题讨论】:
标签: c# audio video-encoding azure-media-services