简体   繁体   中英

Transcoding mxf video file with CopyAudio in Azure Media Services v3

We are using Azure Media Services V3 API to transcode video files of various input formats into mp4 output. In case we have a mxf input file we receive the following exception when trying to transcode video with audio codec 'CopyAudio'): Azure Media ReEncode error message: An error has occurred. Stage: ApplyEncodeCommand. Code: 0x00000001.

This is the same issue as mentioned here ( Copy audio codec throws exception when transcoding mxf video file ), but for the v2 API of Azure Media Services

The answer given there is indeed the solution for Azure Media Services v2. I'm having trouble to port it to the v3 API though. In code we are creating an instance of StandardEncoderPreset (Microsoft.Azure.Management.Media.Models.StandardEncoderPreset) and try to use the CopyAudio codec. Currently I am unable to figure out how to specify the MOVFormat there.

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"
        }
    }

With the preset configured like that I get the same error as mentioned in the original post. CopyAudio only has a property 'Label'. Also been thinking we need to specify an extra format in the list of 'Formats' but I can't find a MOVFormat (or PCMFormat) class.

Our v3 APIs do not yet support writing to MOV output file format. You would need to go with v2 APIs for such Jobs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM