Submits a preset template analysis job.

Usage notes

  • 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 since it is generated. It 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. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the 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. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes SubmitAnalysisJob

The operation that you want to perform. Set the value to SubmitAnalysisJob.

Input String Yes null

The input information about the preset template analysis job to be submitted. The value is 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. ~~29253~~

AnalysisConfig String No null

The job configuration. Set this parameter as required. ~~29253~~

UserData String No testid-001

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

PipelineId String Yes bb558c1cc25b45309aab5be44d19****

The ID of the MPS queue to which the job is added. To view the MPS queue ID, 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 queue is bound to a Message Service (MNS) topic.

Priority String No 10

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

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

Response parameters

Parameter Type Example Description
RequestId String B52658D4-07AB-43CD-82B0-210958A65E23

The ID of the request.

AnalysisJob Object

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

CreationTime String 2014-01-10T12:00:00Z

The time when the job was created.

Percent Long 100

The transcoding progress.

State String Success

The status of the job. Valid values:

  • Submitted: The job has been submitted.
  • Analyzing: The job is being run.
  • Success: The job is successful.
  • Fail: The job fails.
AnalysisConfig Object

The job configuration.

QualityControl Object

The quality control on the job output.

MethodStreaming String network

The playback mode. Valid values:

  • network: online playback
  • local: playback on on-premises devices
  • Default value: network.
RateQuality String 50

The quality level of the job output.

PropertiesControl Object

The control on the attributes of the job output.

Deinterlace String Force

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.
Crop Object

The cropping configuration of video images.

Top String 8

The top margin that was cropped out.

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

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.
Height String 8

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.
Left String 8

The left margin that was cropped out.

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

The cropping mode. Valid values: 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.
Message String The resource operated \"PipelineId\" cannot be found

The error message returned when the job fails.

Priority String 10

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

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

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

MessageId String 3ca84a39a9024f19853b21be9cf9****

The ID of the success message. This parameter is not returned if the job fails.

ErrorMessage String The resource operated \"PipelineId\" cannot be found

The error message returned when the job fails. This parameter is not returned if the job is successful.

ErrorCode String InvalidParameter.ResourceNotFound

The error code returned when the job fails. This parameter is not returned if the job is successful.

TemplateList Array of Template

The list of matched preset templates.

Template
Video Object

The video codec configuration.

Bufsize String 5000

The size of the buffer.

  • Unit: KB.
  • Default value: 6000.
Degrain String 5

The level of the independent denoising algorithm.

BitrateBnd Object

The average bitrate range of the video.

Max String 20

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

Min String 10

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

PixFmt String yuvj420p

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

Codec String H.264

The video codec format. Default value: H.264.

Height String 1880

The height of the video.

  • Unit: pixel.
  • Default value: the original height of the video.
Qscale String 15

The level of quality control on the video.

Bitrate String 10

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

Maxrate String 10

The maximum video bitrate. Unit: Kbit/s.

Profile String baseline

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.
Crf String 27

The constant rate factor, which is the default quality control setting.

  • Default value when the Codec parameter is set to H.264: 23. Default value when the Codec parameter is set to H.265: 26.
  • If this parameter is returned, the setting of the Bitrate parameter is invalid.
Gop String 1

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

Width String 1990

The width of the video.

  • Unit: pixel.
  • Default value: the original width of the video.
Fps String 60

The frame rate.

  • The value is 60 if the frame rate of the input file exceeds 60.
  • Default value: the frame rate of the input file.
Preset String medium

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

ScanMode String progressive

The scan mode. Valid values:

  • interlaced: An interlaced scan was performed.
  • progressive: A progressive scan was performed.
TransConfig Object

The general transcoding configuration.

TransMode String onepass

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

State String Normal

The status of the template. Valid values:

  • Normal: The template is in the normal state.
  • Deleted: The template is deleted.
MuxConfig Object

The transmuxing configuration.

Gif Object

The GIF format.

FinalDelay String 0

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

Loop String 0

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

Segment Object

The segment configuration.

Duration String 60

The length of the segment. Unit: seconds.

Name String FLV-UD

The name of the template.

Audio Object

The audio codec configuration.

Profile String aac_low

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

Codec String mp3

The audio codec format. Default value: aac.

Samplerate String 32000

The sampling rate.

  • Unit: Hz.
  • Default value: 44100.
Qscale String 10

The level of quality control on the audio.

Channels String 1

The number of sound channels. Default value: 2.

Bitrate String 8

The audio bitrate of the output file.

  • Unit: Kbit/s.
  • Default value: 128.
Id String S00000000-00****

The ID of the transcoding template.

Container Object

The container configuration.

Format String flv

The container format.

UserData String testid-001

The custom data.

Code String InvalidParameter.ResourceNotFound

The error code returned when the job fails. This parameter is not returned if the job is successful.

InputFile Object

The information about the job input.

Object String example.flv

The name of the input file uploaded to the OSS bucket.

Location String oss-cn-hangzhou

The ID of the OSS region.

Bucket String example-bucket

The name of the OSS bucket to which the input file is uploaded.

PipelineId String bb558c1cc25b45309aab5be44d19****

The ID of the MPS queue to which the job is added.

Id String 57f6aa3f84824309bcba67231b40****

The ID of the template analysis job.

Examples

Sample requests

http(s)://mts.cn-hangzhou.aliyuncs.com/?Action=SubmitAnalysisJob
&Input={"Bucket":"example-bucket","Location":"oss-cn-hangzhou","Object":"example.flv"}
&AnalysisConfig={"QualityControl":{"RateQuality":25,"MethodStreaming":"network"}}
&UserData=testid-001
&PipelineId=bb558c1cc25b45309aab5be44d19****
&Priority=10
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
    "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****",
        },
        "TemplateList": [
            {
                "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",
        "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 API Error Center.