All Products
Search
Document Center

ApsaraVideo Media Processing:Use Alibaba Cloud CLI to manage MPS

Last Updated:Jun 25, 2026

Alibaba Cloud CLI is a general-purpose command-line tool built on OpenAPI Explorer. You can use it to automate the management and maintenance of ApsaraVideo Media Processing. This topic describes how to call ApsaraVideo Media Processing API operations by using Alibaba Cloud CLI.

Before you start

Get familiar with Alibaba Cloud CLI. For more information, see What is Alibaba Cloud CLI?

Install Alibaba Cloud CLI

Alibaba Cloud CLI is available on Windows, Linux, and macOS. Select an installation package based on your operating system. For more information, see the following topics:

You can also use Cloud Shell to debug Alibaba Cloud CLI commands. For more information, see What is Cloud Shell?

Configure Alibaba Cloud CLI

Important

An Alibaba Cloud account has full permissions to access all API operations of Alibaba Cloud services. Using an Alibaba Cloud account to call API operations may pose security risks. We recommend that you use a Resource Access Management (RAM) user for API calls and routine O&M.

Before you use Alibaba Cloud CLI, you must configure identity credentials and a region ID. Alibaba Cloud CLI supports various credential types. For more information, see the "Credential types" section of the Configure profiles topic. This example uses AccessKey credentials. Perform the following steps:

  1. Create a RAM user and grant the required permissions to the RAM user. For more information, see Create a RAM user and Grant permissions to a RAM user.

    Important

    In this example, the AliyunMTSFullAccess policy is attached to the RAM user. You can also use a custom policy. For more information, see Custom policies for MPS.

  2. Create an AccessKey pair for the RAM user and record the AccessKey ID and AccessKey secret for later credential configuration. For more information, see Create an AccessKey pair.

  3. Obtain and record the ID of an available region for later credential configuration. Alibaba Cloud CLI uses the specified region ID to initiate API calls. For more information, see Endpoints.

    Note

    You can specify the --region option to run a command in a specific region. This option overrides the region in the default profile and environment variable configurations. For more information, see Command line options for API calls.

  4. Use the AccessKey pair of the RAM user to configure AccessKey credentials in the profile named AkProfile. For more information, see the "Configuration examples" section of the Configure profiles topic.

Generate a CLI command

  1. Go to API Explorer for ApsaraVideo Media Processing.

  2. In the left-side search box of the Debugging page, search for the API operation that you want to call. On the Parameters tab of the API operation, specify the parameters based on the API reference. Click the CLI Example tab on the right side to view the generated sample command that contains the specified parameters.

    • Click the image icon to start Cloud Shell and debug the command in Cloud Shell.

    • Click the image icon to copy the sample command to the clipboard. You can then paste and run the command in your local shell.

      • Ensure that the parameter formats are correct when you paste the command into your local shell. For more information, see Parameter formats.

      • By default, OpenAPI Explorer adds the --region option to the generated sample command. This option overrides the region in the default profile and environment variable configurations. You can delete or retain the option based on your requirements.

Call an API operation

Syntax

Alibaba Cloud CLI uses the following command syntax. For more information, see the "Syntax" section of the Generate and run CLI commands topic.

aliyun <command> <subcommand> [options and parameters]

Command options

You can specify command options to change the default behavior or use extended features. Common options:

  • --profile <profileName>: Specifies a profile. When a valid profile is specified, Alibaba Cloud CLI uses it instead of the default profile or environment variable configurations.

  • --help: Displays help information for a command. For more information, see Use the help command.

For more information, see Command line options for API calls.

Examples

Example 1: Use the --help option to list the ApsaraVideo Media Processing API operations supported by Alibaba Cloud CLI. For a complete list, see List of operations by function.

  1. Run the following command:

    aliyun mts --help
  2. View the command output.

    Usage:
      aliyun mts <ApiName> --parameter1 value1 --parameter2 value2 ...
    Product: Mts
    Version: 2014-06-18
    Available Api List:
      ActivateMediaWorkflow              Activates a media workflow.
      AddMedia                           Submits a job to add a media asset.
      AddMediaTag                        Adds tags to a media asset.
      AddMediaWorkflow                   Creates a media workflow.
      AddPipeline                        Creates a pipeline.
      AddSmarttagTemplate                Adds a template for a smart tagging job.
      AddTemplate                        Creates a custom template that includes container, video, and audio stream settings.

Example 2: Use Alibaba Cloud CLI to call the QueryMediaInfoJobList operation of ApsaraVideo Media Processing to query media information jobs. For more information about the QueryMediaInfoJobList operation, see QueryMediaInfoJobList.

  1. Run the following command:

    aliyun mts QueryMediaInfoJobList --region cn-hangzhou --MediaInfoJobIds '23ca1d184c0e4341e5b665e2a12****'
  2. View the command output.

    {
      "NonExistMediaInfoJobIds": {
        "String": [
          "11ce1d184c0e4341e5b665e2a12****"
        ]
      },
      "RequestId": "46A04AA5-B119-41BB-B750-7C5327AC3E7A",
      "MediaInfoJobList": {
        "MediaInfoJob": [
          {
            "CreationTime": "2014-01-10T12:00:00Z",
            "State": "Success",
            "JobId": "23ca1d184c0e4341e5b665e2a12****",
            "UserData": "testid-001",
            "Code": "InvalidParameter.JsonObjectFormatInvalid",
            "Message": "The parameter "*" does not conform to the JSON Object specification",
            "PipelineId": "88c6ca184c0e432bbf5b665e2a15****",
            "Async": true,
            "Input": {
              "Object": "example.mp4",
              "Location": "oss-cn-hangzhou",
              "Bucket": "example-bucket"
            },
            "MNSMessageResult": {
              "MessageId": "123",
              "ErrorMessage": "The parameter \\\"Input\\\" does not conform to the JSON Object specification",
              "ErrorCode": "InvalidParameter.JsonObjectFormatInvalid"
            },
            "Properties": {
              "Width": "1280",
              "Height": "720",
              "Duration": "17.226000",
              "Fps": "25",
              "Bitrate": "1630.045",
              "FileFormat": "QuickTime/MOV",
              "Streams": {
                "VideoStreamList": {
                  "VideoStream": [
                    {
                      "Sar": "1:1",
                      "Height": "1080",
                      "CodecTagString": "[0][0][0][0]",
                      "NetworkCost": {
                        "PreloadTime": "8",
                        "AvgBitrate": "300.34",
                        "CostBandwidth": "10"
                      },
                      "Width": "1920",
                      "Index": "1",
                      "Timebase": "1/1000",
                      "AvgFPS": "23.976025",
                      "PixFmt": "yuv420p",
                      "Lang": "eng",
                      "CodecLongName": "H.264/AVC/MPEG-4 AVC/MPEG-4 part 10",
                      "NumFrames": "100",
                      "Rotate": "180",
                      "Bitrate": "30541090",
                      "HasBFrames": "0",
                      "Profile": "High",
                      "StartTime": "0.042000",
                      "Dar": "16:9",
                      "CodecName": "h264",
                      "Duration": "100",
                      "Fps": "25",
                      "CodecTag": "0x0000",
                      "CodecTimeBase": "1001/48000",
                      "Level": "41",
                      "ColorRange": "700",
                      "ColorTransfer": "R255 G83 B170",
                      "ColorPrimaries": "700"
                    }
                  ]
                },
                "AudioStreamList": {
                  "AudioStream": [
                    {
                      "Timebase": "1/1000",
                      "Index": "1",
                      "SampleFmt": "fltp",
                      "ChannelLayout": "5.1(side)",
                      "Lang": "eng",
                      "Samplerate": "48000",
                      "CodecLongName": "DCA (DTS Coherent Acoustics)",
                      "Channels": "2",
                      "NumFrames": "123",
                      "Bitrate": "1536000",
                      "CodecTagString": "[0][0][0][0]",
                      "StartTime": "0.042000",
                      "CodecName": "acc",
                      "Duration": "123",
                      "CodecTag": "0x0000",
                      "CodecTimeBase": "1/48000"
                    }
                  ]
                },
                "SubtitleStreamList": {
                  "SubtitleStream": [
                    {
                      "Timebase": "1/1000",
                      "Index": "3",
                      "StartTime": "0.000000",
                      "CodecName": "ass",
                      "Lang": "eng",
                      "CodecLongName": "ASS (Advanced SSA) subtitle",
                      "Duration": "1370.116000",
                      "CodecTag": "0x0000",
                      "CodecTimeBase": "0/1",
                      "CodecTagString": "[0][0][0][0]"
                    }
                  ]
                }
              },
              "Format": {
                "StartTime": "0.042000",
                "NumPrograms": "2",
                "Size": "3509895",
                "NumStreams": "1",
                "FormatLongName": "QuickTime/MOV",
                "Duration": "17.226000",
                "Bitrate": "1630.045",
                "FormatName": "mov"
              },
              "FileSize": "3509895"
            }
          }
        ]
      }
    }
    Note

    If an error is returned, verify that the request parameters and their values are valid based on the error code.

    You can also use the request ID from the response or the SDK error message with OpenAPI Diagnostics to run a self-service diagnosis.