All Products
Search
Document Center

ApsaraVideo Media Processing:SubmitAnalysisJob

Last Updated:Sep 27, 2024

Submits a preset template analysis job.

Operation description

  • After you call the SubmitAnalysisJob operation to submit a preset template analysis job, ApsaraVideo Media Processing (MPS) intelligently analyzes the input file of the job and recommends a suitable preset template. You can call the QueryAnalysisJobList operation to query the analysis result or enable asynchronous notifications to receive the analysis result.
  • The analysis result is retained only for two weeks after it is generated. The analysis result is deleted after two weeks. If you use the recommended preset template in a transcoding job after two weeks, the job fails, and the AnalysisResultNotFound error code is returned.

QPS limit

You can call this operation up to 100 times per second per account. Requests that exceed this limit are dropped and you will experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see QPS limit.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
mts:SubmitAnalysisJob
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InputstringYes

The input information about the preset template analysis job to be submitted. The value must be a JSON object. You must log on to the Object Storage Service (OSS) console to grant the read permissions on the specified OSS bucket to MPS. For more information, see the "Input" section of the Parameter details topic.

Note The OSS bucket must reside in the same region as your MPS service.
{"Bucket":"example-bucket","Location":"oss-cn-hangzhou","Object":"example.flv"}
AnalysisConfigstringNo

The job configurations. Set this parameter as required. For more information, see the "AnalysisConfig" section of the Parameter details topic.

{"QualityControl":{"RateQuality":25,"MethodStreaming":"network"}}
UserDatastringNo

The custom data. The custom data can contain letters, digits, and hyphens (-), and can be up to 1,024 bytes in length. The custom data cannot start with a special character.

testid-001
PipelineIdstringYes

The ID of the MPS queue to which the job is submitted. To view the ID of the MPS queue, log on to the MPS console and choose Global Settings > Pipelines in the left-side navigation pane. If you want to enable asynchronous notifications, make sure that the MPS queue is bound to a Message Service (MNS) topic.

bb558c1cc25b45309aab5be44d19****
PrioritystringNo

The priority of the job in the MPS queue to which the job is submitted.

  • Valid values: 1 to 10. A value of 10 indicates the highest priority.
  • Default value: 6.
10

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The ID of the request.

B52658D4-07AB-43CD-82B0-210958A65E23
AnalysisJobobject

The information about the preset template analysis job that was submitted.

CreationTimestring

The time when the job was created.

2014-01-10T12:00:00Z
Percentlong

The transcoding progress.

100
Statestring

The status of the job. Valid values:

  • Submitted: The job is submitted.
  • Analyzing: The job is being run.
  • Success: The job is successful.
  • Fail: The job fails.
Success
AnalysisConfigobject

The job configurations.

QualityControlobject

The quality control on the job output.

MethodStreamingstring

The playback mode. Valid values:

  • network: online playback
  • local: playback on local devices
  • Default value: network.
network
RateQualitystring

The quality level of the output file.

50
PropertiesControlobject

The control on the attributes of the job output.

Deinterlacestring

Indicates whether deinterlacing was forced to run. Valid values:

  • Auto: Deinterlacing was automatically run.
  • Force: Deinterlacing was forced to run.
  • None: Deinterlacing was forced not to run.
Force
Cropobject

The cropping configurations of video images.

Topstring

The top margin that was cropped out.

Note This parameter is invalid if the Mode parameter is set to Auto or None.
8
Widthstring

The width of the video after the margins were cropped out.

Note This parameter is invalid if the Mode parameter is set to Auto or None.
8
Heightstring

The height of the video after the margins were cropped out.

Note This parameter is invalid if the Mode parameter is set to Auto or None.
8
Leftstring

The left margin that was cropped out.

Note This parameter is invalid if the Mode parameter is set to Auto or None.
8
Modestring

The cropping mode. Valid values:

  • Auto: Cropping was automatically run. This is the default value.
  • Force: Cropping was forced to run.
  • None: Cropping was forced not to run.
Auto
Messagestring

The error message returned if the job failed.

The resource operated \"PipelineId\" cannot be found
Prioritystring

The priority of the job in the MPS queue to which the job was submitted.

  • Valid values: 1 to 10. A value of 10 indicates the highest priority.
  • Default value: 10.
10
MNSMessageResultobject

The message sent by MNS to notify users of the job result.

MessageIdstring

The ID of the message returned if the job was successful. This parameter is not returned if the job failed.

3ca84a39a9024f19853b21be9cf9****
ErrorMessagestring

The error message returned if the job failed. This parameter is not returned if the job was successful.

The resource operated \"PipelineId\" cannot be found
ErrorCodestring

The error code returned if the job failed. This parameter is not returned if the job was successful.

InvalidParameter.ResourceNotFound
TemplateListarray<object>

The matched preset templates.

Templateobject

The information about the preset template.

Videoobject

The video codec configurations.

Bufsizestring

The size of the buffer.

  • Unit: KB.
  • Default value: 6000.
5000
Degrainstring

The strength of the independent noise reduction algorithm.

5
BitrateBndobject

The average bitrate range of the video.

Maxstring

The upper limit of the total bitrate. Unit: Kbit/s.

20
Minstring

The lower limit of the total bitrate. Unit: Kbit/s.

10
PixFmtstring

The pixel format for video color encoding. Valid values: standard pixel formats such as yuv420p and yuvj420p.

yuvj420p
Codecstring

The video codec. Default value: H.264.

H.264
Heightstring

The height of the video.

  • Unit: pixel.
  • Default value: the height of the input video.
1880
Qscalestring

The level of quality control on the video.

15
Bitratestring

The average bitrate of the video. Unit: Kbit/s.

10
Maxratestring

The maximum bitrate of the video. Unit: Kbit/s.

10
Profilestring

The codec profile. Valid values:

  • baseline: applicable to mobile devices.
  • main: applicable to standard-definition devices.
  • high: applicable to high-definition devices.
  • Default value: high.
baseline
Crfstring

The constant rate factor.

  • Default value if the Codec parameter is set to H.264: 23. Default value if the Codec parameter is set to H.265: 26.
  • If this parameter is returned, the setting of the Bitrate parameter is invalid.
27
Gopstring

The maximum number of frames between two keyframes. Default value: 250.

1
Widthstring

The width of the video.

  • Unit: pixel.
  • Default value: the width of the input video.
1990
Fpsstring

The frame rate.

  • The value is 60 if the frame rate of the input video exceeds 60.
  • Default value: the frame rate of the input video.
60
Presetstring

The preset video algorithm. Valid values: veryfast, fast, medium, slow, and slower. Default value: medium.

medium
ScanModestring

The scan mode. Valid values:

  • interlaced
  • progressive
progressive
TransConfigobject

The general transcoding configurations.

TransModestring

The transcoding mode. Valid values: onepass, twopass, and CBR. Default value: onepass.

onepass
Statestring

The status of the template.

  • Normal: The template is normal.
  • Deleted: The template is deleted.
Normal
MuxConfigobject

The transmuxing configurations.

Gifobject

The transmuxing configurations for the GIF format.

FinalDelaystring

The interval between two consecutive loops for the GIF format. Unit: 0.01s. For example, a value of 500 indicates 5 seconds.

0
Loopstring

The number of loops for the GIF or WebP format. Default value: 0.

0
Segmentobject

The segment configurations.

Durationstring

The length of the segment. Unit: seconds.

60
Namestring

The name of the template.

FLV-UD
Audioobject

The audio codec configurations.

Profilestring

The codec profile of the audio. Valid values if the Codec parameter is set to aac: aac_low, aac_he, aac_he_v2, aac_ld, and aac_eld.

aac_low
Codecstring

The audio codec format. Default value: acc.

mp3
Sampleratestring

The sampling rate.

  • Unit: Hz.
  • Default value: 44100.
32000
Qscalestring

The level of quality control on the audio.

10
Channelsstring

The number of sound channels. Default value: 2.

1
Bitratestring

The audio bitrate of the output file.

  • Unit: Kbit/s.
  • Default value: 128.
8
Idstring

The ID of the transcoding template.

S00000000-00****
Containerobject

The container format configurations.

Formatstring

The container format.

flv
UserDatastring

The custom data.

testid-001
Codestring

The error code returned if the job failed. This parameter is not returned if the job was successful.

InvalidParameter.ResourceNotFound
InputFileobject

The information about the job input.

Objectstring

The name of the OSS object that is used as the input file.

example.flv
Locationstring

The ID of the OSS region.

oss-cn-hangzhou
Bucketstring

The name of the OSS bucket.

example-bucket
PipelineIdstring

The ID of the MPS queue to which the analysis job was submitted.

bb558c1cc25b45309aab5be44d19****
Idstring

The ID of the template analysis job.

57f6aa3f84824309bcba67231b40****

Examples

Sample success responses

JSONformat

{
  "RequestId": "B52658D4-07AB-43CD-82B0-210958A65E23",
  "AnalysisJob": {
    "CreationTime": "2014-01-10T12:00:00Z",
    "Percent": 100,
    "State": "Success",
    "AnalysisConfig": {
      "QualityControl": {
        "MethodStreaming": "network",
        "RateQuality": "50"
      },
      "PropertiesControl": {
        "Deinterlace": "Force",
        "Crop": {
          "Top": "8",
          "Width": "8",
          "Height": "8",
          "Left": "8",
          "Mode": "Auto"
        }
      }
    },
    "Message": "The resource operated \\\"PipelineId\\\" cannot be found",
    "Priority": "10",
    "MNSMessageResult": {
      "MessageId": "3ca84a39a9024f19853b21be9cf9****",
      "ErrorMessage": "The resource operated \\\"PipelineId\\\" cannot be found",
      "ErrorCode": "InvalidParameter.ResourceNotFound"
    },
    "TemplateList": {
      "Template": [
        {
          "Video": {
            "Bufsize": "5000",
            "Degrain": "5",
            "BitrateBnd": {
              "Max": "20",
              "Min": "10"
            },
            "PixFmt": "yuvj420p",
            "Codec": "H.264",
            "Height": "1880",
            "Qscale": "15",
            "Bitrate": "10",
            "Maxrate": "10",
            "Profile": "baseline",
            "Crf": "27",
            "Gop": "1",
            "Width": "1990",
            "Fps": "60",
            "Preset": "medium",
            "ScanMode": "progressive"
          },
          "TransConfig": {
            "TransMode": "onepass"
          },
          "State": "Normal",
          "MuxConfig": {
            "Gif": {
              "FinalDelay": "0",
              "Loop": "0"
            },
            "Segment": {
              "Duration": "60"
            }
          },
          "Name": "FLV-UD",
          "Audio": {
            "Profile": "aac_low",
            "Codec": "mp3",
            "Samplerate": "32000",
            "Qscale": "10",
            "Channels": "1",
            "Bitrate": "8"
          },
          "Id": "S00000000-00****",
          "Container": {
            "Format": "flv"
          }
        }
      ]
    },
    "UserData": "testid-001",
    "Code": "InvalidParameter.ResourceNotFound",
    "InputFile": {
      "Object": "example.flv",
      "Location": "oss-cn-hangzhou",
      "Bucket": "example-bucket"
    },
    "PipelineId": "bb558c1cc25b45309aab5be44d19****",
    "Id": "57f6aa3f84824309bcba67231b40****"
  }
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history