问题描述
我们正在使用Azure媒体服务(MES处理器)将各种输入格式的视频文件转码为mp4输出格式.如果我们有一个mxf输入文件,则在尝试对视频进行转码时会收到以下异常(带有copyAudio
选项)Azure Media ReEncode error message: An error has occurred. Stage: ApplyEncodeCommand. Code: 0x00000001.
We are using Azure Media Services (MES processor) to transcode video files of various input formats into mp4 output format.In case we have a mxf input file we receive the following exception when trying to transcode video (with option to copyAudio
)Azure Media ReEncode error message: An error has occurred. Stage: ApplyEncodeCommand. Code: 0x00000001.
此异常消息是相当通用的,并没有提供很多有关其原因的见解.知道如何保留原始音频,而只对视频进行转码的任何想法,将不胜感激.
This exception message is fairly generic and doesn't give much insights about reasons for it.Any idea how to keep original audio, while only transcoding video is much appreciated.
配置:
{
"Version": 1.0,
"Sources": null,
"Codecs": [
{
"Type": "H264Video",
"KeyFrameInterval": "00:00:02",
"SceneChangeDetection": true,
"PreserveResolutionAfterRotation": true,
"H264Layers": [
{
"Type": "H264Layer",
"Profile": "Auto",
"Level": "Auto",
"Bitrate": 6221,
"MaxBitrate": 6221,
"BufferWindow": "00:00:05",
"Width": 1920,
"Height": 1080,
"BFrames": 3,
"ReferenceFrames": 3,
"FrameRate": "0/1",
"AdaptiveBFrame": true
}
]
},
{
"Type": "CopyAudio"
}
],
"Outputs": [
{
"FileName": "{Basename}_{Width}x{Height}.mp4",
"Format": {
"Type": "MP4Format"
}
}
]
}
请注意类型为copyAudio
的代码.我们特别感兴趣的是在保留原始音频的同时降低视频质量.
Please note code of type copyAudio
. We're particularly interested in that one in order to preserve original audio, while reducing video quality.
{
"Type": "CopyAudio"
}
CopyAudio编解码器(选项)记录不佳.我们在本示例中找到了它在Microsoft文档中.与相同的配置一起使用时,它可以在各种不同的输入文件中正常工作,而不会出现错误(mov,wmv,avi ...).视频质量下降,而音频被保留.
CopyAudio codec (option) is badly documented. We found it as part of this example in the Microsoft docs.When used with the same configuration it works as expected for various different input files, without error (mov, wmv, avi...). Video quality gets reduced, while audio is preserved.
有关mxf文件的其他信息是,它由8个音频流组成,每个音频流具有1个通道.
Additional information about the mxf file is that it consists of 8 audio streams each having 1 channel.
使用以下立体声编解码器对文件进行正确的转码,例如:
File is properly transcoded with following, stereo codec, for example:
{
"Profile": "AACLC",
"Channels": 2,
"SamplingRate": 48000,
"Bitrate": 128,
"Type": "AACAudio"
}
推荐答案
为了对带PCM音频的MXF文件使用CopyAudio,CopyAudio需要指定一种支持PCM音频的格式.修改后的CopyAudio如下所示:
In order to use CopyAudio for a MXF file with PCM audio, CopyAudio needs to specify a format that supports PCM audio. The modified CopyAudio looks like the following:
{
"Type": "CopyAudio",
"Format": {
"Type": "MOVFormat"
}
}
这篇关于转码MXF视频文件时,复制音频编解码器引发异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!