问题
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.
Configuration:
{
"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"
}
}
]
}
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 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.
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"
}
回答1:
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"
}
}
来源:https://stackoverflow.com/questions/59073257/copy-audio-codec-throws-exception-when-transcoding-mxf-video-file