Polyv Help Center

Help Center

Create Smart Subtitle Task

Updated: 2024-09-03 16:44:09

API Description

1、通过视频id,创建该视频的字幕任务,自动为该视频生成一份字幕文件,字幕文件可通过接口查询,或在点播后台智能字幕模块中使用。详见:[智能字幕](__PLV_KEEP_0__)
2、接口支持https协议

API URL

http://api.polyv.net/vod/v4/smart-subtitle/create

Request Method

POST

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details

Request Parameters

  • URL Parameters
Parameter Required Type Description
appId true String Live streaming appId. You can view your live streaming appId and appSecret in "Cloud VOD" -> "Settings" -> "API Interface"
timestamp true Long Current time in milliseconds, valid within 30 minutes
sign true String Signature, 32-character uppercase MD5 value See MD5 signature generation rules
  • Body Parameters (JSON)
Parameter Required Type Description
vid true String Video ID
autoApplyEnabled false String Whether to automatically apply subtitles to the corresponding video after generation. Values: Y (auto-apply) or N (or omit, do not auto-apply)
language false String If omitted or an unsupported language is provided, defaults to chinese. See language field description
repetitionEnabled false String Whether to allow duplicate tasks. Y-allow, N-disallow, default Y

Language Field Description

Parameter Value Language
chinese Chinese
chinese_english_cantonese Chinese, English, Cantonese
chinese_medical Chinese Medical
cantonese Cantonese
english English
japanese Japanese
korean Korean
vietnamese Vietnamese
malay Malay
indonesian Indonesian
filipino Filipino
thai Thai
portuguese Portuguese
turkish Turkish
arabic Arabic
spanish Spanish
spanish Spanish

Example

https://api.polyv.net/vod/v4/smart-subtitle/create?timestamp=1680148356376&appId=XXXXXXXXXX&sign=7E07C6293779BAC60F95DEC2FDDPB353

Parameters:

{
    "vid": "833u3s271d15dd452bf8393cfd5d4ac6_8",
    "language": "chinese",
    "autoApplyEnabled": "Y"
}

Response Parameters

Parameter Type Description
code Integer Response status code. 200 for success, non-200 for failure See global error description
status String Response status text
requestId String Unique request ID. If the API call fails, provide this ID to customer service for troubleshooting
success boolean true indicates successful API call, false indicates failure
data Long Returns subtitle task ID on success, null on failure. After subtitle generation, use this task ID to query subtitle file links and data
error Object Error description when API call fails See error field description

Error Field Description

Parameter Type Description
code Integer Error code See error code list
desc String Error description See error code list

Error Code List

code desc Description
10002 Signature error Signature error. Check if the sign parameter is correctly generated
10003 Timestamp expired Timestamp expired
20003 application not found. appId not found. Check if appId is passed correctly
56800 Invalid VID Video does not exist; video status is incorrect (not published); video duration exceeds 5 hours
56809 Insufficient resources or balance Insufficient resources or balance. Please recharge before use

Response Example

Success Example

{
    "code": 200,
    "status": "success",
    "requestId": "f813d5d2359743028b6648e54ade1bf1.55.16801596733770029",
    "data": 1000,
    "success": true
}

Error Example

Timestamp Expired

{
    "code": 400,
    "status": "error",
    "error": {
        "code": 10003,
        "desc": "时间戳过期"
    },
    "success": false
}

Signature Error

{
    "code": 403,
    "status": "error",
    "error": {
        "code": 10002,
        "desc": "签名错误"
    },
    "success": false
}
联系客服,在线咨询