Video Subtitle Removal
Description
This API processes video subtitle removal requests in the cloud.
Version
1.0
Media Requirements
The input media must be an MP4 video.
API URL
Production environment: https://openapi.meitu.com
Task submission endpoint: https://openapi.meitu.com/api/v1/sdk/sync/push
Task name (task): /v1/videosubtitle_remove/485023
Task type (task_type): formulaMethod
POST
Content-Type: application/json
Authentication
Request Parameters
| Required | Parameter | Type | Description |
|---|---|---|---|
| Yes | params | string | Algorithm parameters (JSON string) |
| Yes | init_images | object[] | List of video files |
| Yes | task | string | Fixed value: /v1/videosubtitle_remove/485023 |
| Yes | task_type | string | Fixed value: formula |
| No | sync_timeout | int | Default: 30. If synchronous processing times out, status=9 is returned and the query API can be used to retrieve the result. |
The init_images multimedia file parameters are structured as follows:
| Required | Parameter | Type | Description |
|---|---|---|---|
| Yes | url | string | Video URL or base64-encoded data |
| Yes | profile | object | Media attribute information |
The profile attribute information is structured as follows:
| Required | Parameter | Type | Description |
|---|---|---|---|
| Yes | media_profiles | object | Media attributes |
| Yes | version | string | Fixed value: v1 |
The media_profiles media attributes are structured as follows:
| Required | Parameter | Type | Description |
|---|---|---|---|
| Yes | media_data_type | string | url indicates a URL; the corresponding media type indicates base64-encoded data. |
The params inference parameters are provided as a JSON string with the following structure:
| Required | Field | Type | Description |
|---|---|---|---|
| No | rsp_media_type | string | Default: url, which returns the result as a URL. |
| Yes | parameter | object | Core algorithm parameter object |
Details of the parameter algorithm parameters:
| Required | Field | Type | Description |
|---|---|---|---|
| No | version | string | Algorithm version. Supported values include 1.0.0 and 2.0.0; default: 1.0.0. |
| No | userboxes | string | User-defined bounding-box coordinates. Starting at the upper-left corner, provide normalized coordinates for four points clockwise through the lower-left corner. No default box is specified. |
Request Example
{
"task": "/v1/videosubtitle_remove/485023",
"task_type": "formula",
"init_images": [
{
"url": "https://xxx.mp4",
"profile": {
"media_profiles": {
"media_data_type": "url"
},
"version": "v1"
}
}
],
"params": "{\"rsp_media_type\":\"url\",\"parameter\":{\"userboxes\":\"[[[0, 0.5], [1, 0.5], [1, 0.8], [0, 0.8]]]\"}}",
"sync_timeout": 30
}Response Fields
Generated results are periodically deleted. Download and save them promptly.| Field | Type | Description |
|---|---|---|
| request_id | string | Request identifier |
| trace_id | string | Trace identifier |
| code | int | Business status code; 0 indicates that the request was accepted successfully. |
| error_code | int | Error code; 0 indicates success. |
| message | string | Business message |
| tips | any | Additional information; may be null. |
| data | object | Task status and algorithm result |
Fields in data:
| Field | Type | Description |
|---|---|---|
| status | int | Status code: -1, task not found; 0, created successfully; 1, processing; 2, failed; 9, timed out—use the Query API; 10, succeeded. |
| result | object | Algorithm result |
| progress | number | Task progress |
| predict_elapsed | int | Estimated processing time in milliseconds |
| create_time | int64 | Creation timestamp in milliseconds |
| task_id | string | Task ID |
| custom_task_id | string | Client-defined task ID |
| trace_id | string | Trace identifier within data |
| client_info | string | Client information |
| init_images | object[]/null | Echo of the input media |
Fields in result:
| Field | Type | Description |
|---|---|---|
| id | string | Result task ID |
| urls | array | List of output video URLs |
| images | array | List of output image or video URLs |
| parameters | object | Echo of request parameters |
| data | object | Internal result data, including timing and media information |
| msg | string | Response message |
| msg_id | string | Message ID |
| mtlab_res | object | MTLab-compatible result fields, including error information |
| media_info_list | array | List of media information |
Fields in result.parameters:
| Field | Type | Description |
|---|---|---|
| exist_text | bool | Whether subtitle text is present |
| rsp_media_type | string | Response media type, such as url |
| version | string | Algorithm version information, such as VideoSubtitleRemove version: 2.0.3 |
Fields in result.data:
| Field | Type | Description |
|---|---|---|
| duration | object | Timing information by category |
| error_code | int | Error code |
| error_msg | string | Error message |
| extra | object | Additional data |
| media_info_list | array | List of media data |
| msg_id | string | Message ID |
| parameter | object | Parameters; identical to parameters |
Fields in result.data.duration:
| Field | Type | Description |
|---|---|---|
| alg_process_time | int | Algorithm processing time |
| created_timestamp | int64 | Creation timestamp |
| pull_timestamp | int64 | Pull timestamp |
| repost_time | int | Forwarding time |
| upload_time | int | Upload time |
| waiting_time | int | Waiting time |
Fields in the result.data.extra.trans_meta.rsp_meta array:
| Field | Type | Description |
|---|---|---|
| data_rate | float | Data bitrate |
| duration | int | Duration |
| frame_num | int | Number of frames |
| frame_rate | float | Frame rate |
| height | int | Height |
| media_type | string | Media type |
| size | int | File size |
| width | int | Width |
Fields in each media_info_list array element:
| Field | Type | Description |
|---|---|---|
| media_data | string | Media URL |
| media_extra | object/null | Additional information |
| media_profiles | object | Media attributes |
Fields in media_profiles:
| Field | Type | Description |
|---|---|---|
| media_data_fps | float | Frame rate |
| media_data_height | int | Height |
| media_data_size | int | File size |
| media_data_type | string | Type, such as url |
| media_data_width | int | Width |
Fields in mtlab_res:
| Field | Type | Description |
|---|---|---|
| ErrorCode | int | Error code |
| ErrorMsg | string | Error message |
| error_code | int | Error code |
| error_msg | string | Error message |
| media_info_list | array/null | Media information |
| msg_id | string | Message ID |
| parameter | object/null | Parameters |
Response Examples
Successful Response Example
{
"request_id": "request_id",
"trace_id": "trace_id",
"code": 0,
"error_code": 0,
"message": "success",
"tips": null,
"data": {
"status": 10,
"result": {
"id": "task_id",
"urls": [
"https://obs-large.mtlab.meitu.com/mtopen/30f1b44ea57c4d94bbdfda14005b7332/e034c450-6ca4-4b2e-409d-b594a35cce50/e034c450-6ca4-4b2e-409d-b594a35cce50.mp4"
],
"images": [
"https://obs-large.mtlab.meitu.com/mtopen/30f1b44ea57c4d94bbdfda14005b7332/e034c450-6ca4-4b2e-409d-b594a35cce50/e034c450-6ca4-4b2e-409d-b594a35cce50.mp4"
],
"parameters": {
"exist_text": true,
"rsp_media_type": "url",
"version": "VideoSubtitleRemove version: 2.0.3"
},
"data": {
"duration": {
"alg_process_time": 158283,
"created_timestamp": 1765098852,
"pull_timestamp": 1765098852,
"repost_time": 0,
"upload_time": 1135,
"waiting_time": 153
},
"error_code": 0,
"error_msg": "success",
"extra": {
"trans_meta": {
"rsp_meta": [
{
"data_rate": 51369.922,
"duration": 0,
"frame_num": 1537,
"frame_rate": 29.92023277282715,
"height": 720,
"media_type": "video",
"size": 33731714,
"width": 960
}
]
}
},
"media_info_list": [
{
"media_data": "https://obs-large.mtlab.meitu.com/mtopen/30f1b44ea57c4d94bbdfda14005b7332/e034c450-6ca4-4b2e-409d-b594a35cce50/e034c450-6ca4-4b2e-409d-b594a35cce50.mp4",
"media_extra": null,
"media_profiles": {
"media_data_fps": 29.92023277282715,
"media_data_height": 720,
"media_data_size": 33731714,
"media_data_type": "url",
"media_data_width": 960
}
}
],
"msg_id": "msg_id",
"parameter": {
"exist_text": true,
"rsp_media_type": "url",
"version": "VideoSubtitleRemove version: 2.0.3"
}
},
"msg": "success",
"msg_id": "msg_id",
"mtlab_res": {
"ErrorCode": 0,
"ErrorMsg": "",
"error_code": 0,
"error_msg": "",
"media_info_list": null,
"msg_id": "msg_id",
"parameter": null
},
"media_info_list": [
{
"media_data": "https://obs-large.mtlab.meitu.com/mtopen/30f1b44ea57c4d94bbdfda14005b7332/e034c450-6ca4-4b2e-409d-b594a35cce50/e034c450-6ca4-4b2e-409d-b594a35cce50.mp4",
"media_extra": null,
"media_profiles": {
"media_data_fps": 29.92023277282715,
"media_data_height": 720,
"media_data_size": 33731714,
"media_data_type": "url",
"media_data_width": 960
}
}
]
},
"progress": 1,
"predict_elapsed": 10000,
"create_time": 1765098852464,
"task_id": "task_id",
"custom_task_id": "",
"trace_id": "",
"client_info": "",
"init_images": null
}
}Query-Required Response Example
Use the Query API to retrieve the result.
Response Status: 200
Content-Type: application/json; charset=utf-8
{
"request_id": "request_id",
"trace_id": "trace_id",
"code": 0,
"error_code": 0,
"message": "processing timeout",
"tips": null,
"data": {
"status": 9,
"result": {},
"progress": 0,
"predict_elapsed": 0,
"create_time": 1765098852464,
"task_id": "task_id",
"custom_task_id": "",
"trace_id": "trace_id",
"client_info": "",
"init_images": null
}
}Failed Response Example
Response Status: 400
Content-Type: application/json; charset=utf-8
{
"request_id": "request_id",
"trace_id": "trace_id",
"code": 20001,
"error_code": 20001,
"message": "PROCESS_ERROR",
"tips": null,
"data": {
"status": 2,
"result": {
"ErrorCode": 20001,
"ErrorMsg": "PROCESS_ERROR",
"Data": null
},
"progress": 0,
"predict_elapsed": 0,
"create_time": 1765098852464,
"task_id": "task_id",
"custom_task_id": "",
"trace_id": "trace_id",
"client_info": "",
"init_images": null
}
}General Error Codes and Messages
See API Error Codes.
SDK Examples
Python
import json
import requests
from sign_sdk import sign
def api_call_example():
key = "your_api_key"
secret = "your_api_secret"
url = "https://openapi.meitu.com/api/v1/sdk/sync/push"
method = "POST"
headers = {
"Content-Type": "application/json",
sign.HeaderHost: "openapi.meitu.com",
}
inner_params = {
"rsp_media_type": "url",
"parameter": {
"userboxes": "[[[0, 0.5], [1, 0.5], [1, 0.8], [0, 0.8]]]"
},
}
payload = {
"task": "/v1/videosubtitle_remove/485023",
"task_type": "formula",
"init_images": [
{
"url": "https://xxx.mp4",
"profile": {
"media_profiles": {"media_data_type": "url"},
"version": "v1",
},
}
],
"params": json.dumps(inner_params, ensure_ascii=False),
"sync_timeout": 30,
}
body = json.dumps(payload, ensure_ascii=False)
signer = sign.Signer(key, secret)
signed_request = signer.sign(url, method, headers, body)
response = requests.Session().send(signed_request)
print(f"Status: {response.status_code}")
print(f"Response: {response.text}")
if __name__ == "__main__":
api_call_example()Go
package main
import (
"fmt"
"io"
"net/http"
"github.com/mtlab/api/signer"
)
func main() {
key := "your_api_key"
secret := "your_api_secret"
signObj := signer.NewSigner(key, secret)
url := "https://openapi.meitu.com/api/v1/sdk/sync/push"
method := http.MethodPost
headers := make(http.Header)
headers.Set(signer.HeaderHost, "openapi.meitu.com")
headers.Set("Content-Type", "application/json")
body := `{
"task": "/v1/videosubtitle_remove/485023",
"task_type": "formula",
"init_images": [{
"url": "https://xxx.mp4",
"profile": {
"media_profiles": {"media_data_type": "url"},
"version": "v1"
}
}],
"params": "{\"rsp_media_type\":\"url\",\"parameter\":{\"userboxes\":\"[[[0, 0.5], [1, 0.5], [1, 0.8], [0, 0.8]]]\"}}",
"sync_timeout": 30
}`
req, err := signObj.Sign(url, method, headers, body)
if err != nil {
fmt.Println("Failed to sign request:", err)
return
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
fmt.Println("Failed to send request:", err)
return
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
fmt.Println("Read response failed:", err)
return
}
fmt.Println("Response:", resp.StatusCode, string(responseBody))
}PHP
<?php
require 'signer.php';
$key = 'your_api_key';
$secret = 'your_api_secret';
$signer = new Signer($key, $secret);
$url = 'https://openapi.meitu.com/api/v1/sdk/sync/push';
$method = 'POST';
$headers = ['Content-Type' => 'application/json'];
$innerParams = json_encode([
'rsp_media_type' => 'url',
'parameter' => [
'userboxes' => '[[[0, 0.5], [1, 0.5], [1, 0.8], [0, 0.8]]]',
],
]);
$body = json_encode([
'task' => '/v1/videosubtitle_remove/485023',
'task_type' => 'formula',
'init_images' => [
[
'url' => 'https://xxx.mp4',
'profile' => [
'media_profiles' => ['media_data_type' => 'url'],
'version' => 'v1',
],
],
],
'params' => $innerParams,
'sync_timeout' => 30,
]);
$curl = $signer->sign($url, $method, $headers, $body);
$response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($status === 0) {
echo 'Error: ' . curl_error($curl);
} else {
echo "Status: {$status}\n";
echo "Response: {$response}\n";
}
curl_close($curl);
?>Java
package com.meitu.openai.common;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) throws Exception {
Signer signer = new Signer("your_api_key", "your_api_secret");
String url = "https://openapi.meitu.com/api/v1/sdk/sync/push";
String method = "POST";
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");
headers.put(Signer.HeaderHost, "openapi.meitu.com");
String body = "{\n" +
" \"task\": \"/v1/videosubtitle_remove/485023\",\n" +
" \"task_type\": \"formula\",\n" +
" \"init_images\": [{\n" +
" \"url\": \"https://xxx.mp4\",\n" +
" \"profile\": {\n" +
" \"media_profiles\": {\"media_data_type\": \"url\"},\n" +
" \"version\": \"v1\"\n" +
" }\n" +
" }],\n" +
" \"params\": \"{\\\"rsp_media_type\\\":\\\"url\\\",\\\"parameter\\\":{\\\"userboxes\\\":\\\"[[[0, 0.5], [1, 0.5], [1, 0.8], [0, 0.8]]]\\\"}}\",\n" +
" \"sync_timeout\": 30\n" +
"}";
Map<String, String> signedHeaders = signer.sign(url, method, headers, body);
HttpURLConnection connection =
(HttpURLConnection) new URL(url).openConnection();
connection.setRequestMethod(method);
for (Map.Entry<String, String> entry : signedHeaders.entrySet()) {
connection.setRequestProperty(entry.getKey(), entry.getValue());
}
connection.setDoOutput(true);
connection.getOutputStream().write(body.getBytes(StandardCharsets.UTF_8));
int status = connection.getResponseCode();
InputStream stream = status >= 400
? connection.getErrorStream()
: connection.getInputStream();
try (BufferedReader reader =
new BufferedReader(new InputStreamReader(stream))) {
StringBuilder response = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
response.append(line);
}
System.out.println("Response: " + status + " " + response);
}
}
}