none
Analyzer Preset task fails during "client.Jobs.CreateAsync" RRS feed

  • Question

  • I am pretty much using the encoding Transform code as specified in Create a Transform with Encoding Custom Preset in this link. https://docs.microsoft.com/en-us/azure/media-services/latest/customize-encoder-presets-how-to

    As a next task to this encoding, I want to add "Audio Analyzer Preset" for indexing the video. I have added that TransformOutput as below;

    TransformOutput[] outputs = new TransformOutput[]
    {
         new TransformOutput
         (
            new StandardEncoderPreset
           (
              codecs: new Codec[]
              {
                 new AacAudio
                 (
                    channels: 2,
                    samplingRate: 48000,
                    bitrate: 128000,
                    profile: AacAudioProfile.AacLc
                 ),
                 new H264Video
                 ( keyFrameInterval:TimeSpan.FromSeconds(2),
                   layers:  new H264Layer[]
                            {
                               new H264Layer
                               (
                                  bitrate: 600000,
                                  width: "640",
                                  height: "360",
                                  label: "SD"
                               )
                            }
                 ),                          
                 new PngImage
                 (
                   start: "25%",
                   step: "25%",
                   range: "80%",
                   layers: new PngLayer[]
                   {
                      new PngLayer
                      (
                         width: "25%",
                         height: "25%"
                      )
                   }
                )
            },
            formats: new Format[]
            {
               new Mp4Format
              (                            
                 filenamePattern:objectID+"-{Basename}-{Label}- 
    {Bitrate}{Extension}"
              ),
              new PngFormat
              (                            
                 filenamePattern:objectID+"-{Basename}-{Index}{Extension}"
              )
            }
        ),
        onError: OnErrorType.StopProcessingJob,
        relativePriority: Priority.Normal
      ),
       new TransformOutput(analyzerPreset)
    };
    
    transform = client.Transforms.CreateOrUpdate(resourceGroupName, accountName, transformName, outputs, description);

    But if I add the second TransformOutput of analyzerPreset, it is failing in executing the job with following error message;

    CreateOutputAssetAsync jobInput : Microsoft.Azure.Management.Media.Models.JobInputAsset
    RunMainJobError:Operation returned an invalid status code 'BadRequest'
    Operation returned an invalid status code 'BadRequest'
    ERROR: API call failed with error code 'BadRequest' and message 'The Transform 'AdaptiveStreamingPreset' expects 2 Job outputs, but 1 was provided.'.
    InnerError:One or more errors occurred.,Operation returned an invalid status code 'BadRequest'

    How to add analyzer preset task to Transform?

    Monday, October 14, 2019 1:23 AM

Answers

All replies

  • Can you please share the code snipped where you submit the Job? As the message suggests, your Transform has two TransformOutputs, which means that the Job should have two JobOutputAsset entries in the JobOutput[] array. 

    Thanks

    Monday, October 14, 2019 1:41 AM
  • public static async Task<Job> SubmitJobAsync(IAzureMediaServicesClient client, string resourceGroupName, string accountName, string transformName, string jobName, JobInput jobInput, string outputAssetName)
    {
       JobOutput[] jobOutputs =
       {
          new JobOutputAsset(outputAssetName)
       };
    
       Job job = await client.Jobs.CreateAsync(resourceGroupName, accountName, transformName, jobName,
                    new Job
                    {
                        Input = jobInput,
                        Outputs = jobOutputs,
                    }
       );
    
       return job;
    }
    This is the SubmitJobAsync method. Do I need to add one more "new JobOutputAsset" with same outputAssetName?
    Monday, October 14, 2019 3:13 AM
  • Yes, your JobOutputs are literally just:

       JobOutput[] jobOutputs =
       {
          new JobOutputAsset(outputAssetName),
          new JobOutputAsset(outputAssetName)
       };

    Assuming you want the output of both put into the same output asset.

    Tuesday, October 15, 2019 3:14 AM
    Moderator