All Products
Search
Document Center

ApsaraVideo VOD:Caption extraction

Last Updated:Jun 17, 2025

The micro drama solution provides the capability to extract captions through API. This topic explains the basic API calling methods for micro drama caption extraction jobs.

Note

The prerequisite for micro drama solution caption extraction jobs is: Activate.

Caption extraction

Operation description

Calling SubmitIProductionJob for caption extraction jobs is executed asynchronously. For more information, see SubmitIProductionJob - Submit intelligent production task.

Parameter description

Name

Type

Required

Description

Example value

Name

string

No

The task name. The name cannot exceed 100 characters.

Test task

FunctionName

string

Yes

Caption extraction: CaptionExtraction

CaptionExtraction

Input

object

Yes

Input media. OSS is supported.

Type

string

Yes

Media type:

  • OSS: an OSS object.

OSS

Media

string

Yes

Input media. The OSS address rules are:

  1. oss://bucket/object

  2. http(s)://bucket.oss-[regionId].aliyuncs.com/object where bucket is the name of an OSS bucket in the same region as the current project, and object is the file path.

oss://example-bucket/example-object.mp4

Output

object

Yes

Output media. OSS is supported.

Type

string

Yes

Media type:

  • OSS: an OSS object.

OSS

Media

string

Yes

Output media. The OSS address rules are:

  1. oss://bucket/object

  2. http(s)://bucket.oss-[RegionId].aliyuncs.com/object where bucket is the name of an OSS bucket in the same region as the current project, and object is the file path.

oss://example-bucket/output.srt

TemplateId

string

No

Template ID

****20b48fb04483915d4f2cd8ac****

JobParams

string

No

Algorithm job parameters, JSON object. Different algorithms correspond to different parameter contents. See the supplementary description for details.

{fps:10,sep:false,roi:[[0.5, 1], [0, 1]]}

ScheduleConfig

object

No

Task scheduling configuration information

PipelineId

string

No

Pipeline ID

5246********c3dc

Priority

integer

No

The value range is from 1 to 10. A smaller value indicates a higher priority.

6

UserData

string

No

User-defined data, returned as-is when obtaining results. The length cannot exceed 1,024 bytes.

{"test":1}

JobParams supplementary description

Name

Type

Required

Description

Example value

fps

Int

No

Sampling frame rate (optional), integer, value range [2,10], default 5.

10

roi

List

No

Caption selection area.

  • If a selection area is input, only captions within the area will be extracted, and text outside the area will be ignored. If this parameter is not filled, the bottom 1/4 area of the video will be detected by default.

  • Format: [[top, bottom], [left, right]].

  • Default: None.

[[0.5, 1], [0, 1]]

sep

Boolean

No

Whether to separate Chinese and English output into two srt files, optional, default False.

formatter

String

No

The format string for SRT captions (optional), for example: "{\an8}", default is none.

Diagram

lQLPKGcE1cH3dxfNBFfNAyCwIv7L_7b8h34G2SBvzL5wAA_800_1111.png

Example

Scenario:

  • Caption extraction feature

  • Algorithm job parameters: set sampling frame rate to 10, caption selection area to the lower half area

  • Input: OSS address

  • Output: OSS address

{
  "functionName": "CaptionExtraction",
  "jobParams": "{fps:10,sep:false,roi:[[0.5, 1], [0, 1]]}",
  "input":{
    "type": "OSS",
    "media": "oss://example-bucket/example-object.mp4"
  },
  "output":{
    "type": "OSS",
    "media": "oss://example-bucket/output.srt"
  }
}

Callback

{
  "jobId":"270d****0d1a",
  "requestId":"********-****-****-****-************"
}

Caption extraction result query

Operation description

You can call QueryIProductionJob to query the status and results of caption extraction tasks. For more information, see QueryIProductionJob - Query intelligent production task.

Parameter description

Request parameters

Name

Type

Required

Description

Example value

JobId

string

No

The ID of the intelligent production job to be queried. Obtained from the return parameters of SubmitIProductionJob.

270d****0d1a

Response parameters

Name

Type

Description

Example value

RequestId

string

Request ID

JobId

string

Task ID

****20b48fb04483915d4f2cd8ac****

Name

string

Task name

Test task

FunctionName

string

Caption extraction: CaptionExtraction

Cover

Input

object

Input media.

Type

string

Media type.

OSS

Media

string

Input media path.

oss://example-bucket/example-object.mp4

Output

object

Output media.

Type

string

Media type.

OSS

Media

string

Output media path.

oss://example-bucket/output.srt

TemplateId

string

Template ID

****96e8864746a0b6f3****

JobParams

string

Algorithm job parameters, JSON object. Different algorithms correspond to different parameter contents.

{"Model":"gif"}

ScheduleConfig

object

Task configuration information

PipelineId

string

Pipeline ID

a54f********5e86

Priority

integer

The priority of the task in its corresponding pipeline.

  • Highest priority: 10.

  • Default value: 6.

6

UserData

string

User-defined data, returned as-is when obtaining results

{"test":1}

Result

string

Result information output by the algorithm. Different FunctionNames have different outputs, output in JSON format. See the supplementary description below

{}

CreateTime

string

Creation time, GMT time

2022-07-07T07:16:11Z

FinishTime

string

Completion time, GMT time

2021-11-26T14:50:25Z

Status

string

The status of the job. Valid values:

  • Queuing

  • Analysing

  • Failed.

  • Success

Success

OutputFiles

array

Output file array

string

Generated file path and name

output.srt

OutputUrls

array

Output file URL array

string

Accessible URL path of the generated file

http://xxx

Sample callback

{
  "createTime": "2024-09-24T06:17:09Z",
  "finishTime": "2024-09-24T06:17:31Z",
  "functionName": "CaptionExtraction",
  "input":{
    "type": "OSS",
    "media": "oss://example-bucket/example-object.mp4"
  },
  "jobId": "270d****0d1a",
  "jobParams": "{\"fps\":10,\"roi\":[[0.5,1],[0,1]],\"sep\":false}",
  "output":{
    "type": "OSS",
    "media": "oss://example-bucket/output.srt"
  },
  "outputFiles": [
    "output.srt"
  ],
  "outputUrls": [
    "http://example-bucket.oss-region.aliyuncs.com/output.srt"
  ],
  "requestId": "********-****-****-****-************",
  "result": "{}",
  "status": "Success"
}