SubmitASRJob

更新时间:
复制 MD 格式

Transcribes speech from a media file and returns the text with corresponding start and end timestamps.

Operation description

This is an asynchronous API. After you submit a job, the API returns a job ID and processes the job in the background. The results are sent through a callback notification, or you can query the job status by calling the GetSmartTaskResult operation.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ice:SubmitASRJob

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

InputFile

string

No

The input configuration. Specify either an OSS URL or a media ID from the media library.

oss://example-bucket.oss-cn-shanghai.aliyuncs.com/example.mp4 或 ****20b48fb04483915d4f2cd8ac****

UserData

string

No

User-defined settings in JSON format. Use this to pass business-related data, such as the operating environment or other job details.

{ "user": "data", "env": "prod" }

Title

string

No

The job title. The maximum length is 128 bytes.

测试标题

Description

string

No

The job description. The maximum length is 128 bytes.

测试描述

StartTime

string

No

The start time of the segment to be transcribed from the media file.

00:00:00

Duration

string

No

The duration of the segment to transcribe.

00:00:10

EditingConfig

string

No

The configuration for speech-to-text conversion:

  • HotwordLibraryIdList: A list of custom vocabulary IDs. Only one custom vocabulary ID is currently supported. Future releases will support multiple IDs.

{ "HotwordLibraryIdList": "******2609a14f54a0636b7e16******" }

Response elements

Element

Type

Description

Example

object

The response body.

RequestId

string

The request ID.

******11-DB8D-4A9A-875B-275798******

JobId

string

The ID of the intelligent job.

****20b48fb04483915d4f2cd8ac****

State

string

The job status. Valid values:

  • Created

  • Executing

  • Finished

  • Failed

Finished

To query the result of an ASR job, call the GetSmartTaskResult operation with the job ID. A successful job returns a response similar to the following example.

{
  "RequestId": "******2D-443C-5043-B0E4-867070******",
  "JobResult": {
    "AiResult": "[{\"content\":\"提起\",\"from\":0.0,\"to\":0.846},{\"content\":\"现在可以说是红的发紫了\",\"from\":0.846,\"to\":3.386},{\"content\":\"常常票价很高\",\"from\":3.386,\"to\":4.402},{\"content\":\"但是一开手就被疯抢一空\",\"from\":4.402,\"to\":6.265},{\"content\":\"还参加各种相声综艺节目点评新人表演演员已经\",\"from\":6.265,\"to\":10.33}]"
  },
  "State": "Finished",
  "Output": "[{\"content\":\"提起\",\"from\":0.0,\"to\":0.846},{\"content\":\"现在的可以说是红的发紫了\",\"from\":0.846,\"to\":3.386},{\"content\":\"常常票价很高\",\"from\":3.386,\"to\":4.402},{\"content\":\"但是一开手就被疯抢一空\",\"from\":4.402,\"to\":6.265},{\"content\":\"还参加各种相声综艺节目点评新人表演演员已经\",\"from\":6.265,\"to\":10.33}]",
  "JobId": "******042d5e4db6866f6289d1******",
  "SmartJobInfo": {
    "JobType": "ASR",
    "ModifiedTime": "2022-01-21T06:15:08Z",
    "UserId": 1234562230123456,
    "CreateTime": "2022-01-21T06:15:02Z",
    "Title": "default_title_2022-01-21T06:15:02Z",
    "InputConfig": {
      "JobParameters": "{\"duration\":\"00:30:00\",\"start_time\":\"00:00:00\",\"request_params\":\"&enable_word_level_result=true\"}",
      "InputFile": "oss://your-bucket.oss-cn-shanghai.aliyuncs.com/your-video.mp4"
    }
  }
}

Examples

Success response

JSON format

{
  "RequestId": "******11-DB8D-4A9A-875B-275798******",
  "JobId": "****20b48fb04483915d4f2cd8ac****",
  "State": "Finished"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.