The micro drama solution allows you to extract captions through API. Learn the basic API calling methods for micro drama caption extraction jobs.
The prerequisite for micro drama solution caption extraction jobs is: Activate.
Caption extraction
Operation description
Caption extraction jobs are executed asynchronously by calling SubmitIProductionJob. 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 |
|
Media |
string |
Yes |
Input media. The OSS address rules are:
|
oss://example-bucket/example-object.mp4 |
|
Output |
object |
Yes |
Output media. OSS is supported. |
|
|
Type |
string |
Yes |
Media type:
|
OSS |
|
Media |
string |
Yes |
Output media. The OSS address rules are:
|
oss://example-bucket/output.srt |
|
TemplateId |
string |
No |
Template ID |
****20b48fb04483915d4f2cd8ac**** |
|
JobParams |
string |
No |
Algorithm job parameters in JSON format. Different algorithms use different parameters. See the supplementary description for details. |
{fps:10,sep:false,roi:[[0.5, 1], [0, 1]]} |
|
ScheduleConfig |
object |
No |
Task scheduling configuration |
|
|
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.
|
[[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

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
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 intelligent production job ID to query. 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 in JSON format. Different algorithms use different parameters. |
{"Model":"gif"} |
|
ScheduleConfig |
object |
Task scheduling configuration |
|
|
PipelineId |
string |
Pipeline ID |
a54f********5e86 |
|
Priority |
integer |
Task priority in its corresponding pipeline.
|
6 |
|
UserData |
string |
User-defined data, returned as-is when obtaining results |
{"test":1} |
|
Result |
string |
Algorithm result in JSON format. Different FunctionName values produce different outputs. 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:
|
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"
}