Video Super Resolution
Description
This API provides video super-resolution processing. See the details below for supported options and response structures.
Version
2.0
Media Requirements
Video Formats
Supported formats: h263, h264, h265, AV1, MPEG4, VP8, and VP9.
Video Dimensions
Minimum: pvg does not support dimensions smaller than 144*144. Maximum: hardware codecs support a maximum long edge of 4096 pixels, and both the width and height must be even numbers.
API URL
Production environment: https://openapi.meitu.com
Task submission endpoint: https://openapi.meitu.com/api/v1/sdk/sync/push
Task name (`task`): /v1/video_super_resolution/488146
Task type (`task_type`): formulaMethod
POST
Content-Type: application/json
Authentication
Request Parameters
| Required | Parameter | Type | Description |
|---|---|---|---|
| Yes | task | String | Task path, for example: /v1/video_super_resolution/488146 |
| Yes | task_type | String | Task type. Fixed value: formula |
| Yes | init_images | Object[] | Input media file parameters |
| Yes | params | String | Inference parameters (JSON string) |
| No | sync_timeout | Int | Synchronous timeout in seconds. Default: 30 |
init_images media file parameters are described below.
init_images is an array. Each element represents a media resource, such as a video or watermark image.
| Required | Parameter | Type | Description |
|---|---|---|---|
| Yes | url | String | Media file URL |
| Yes | profile | Object | Media configuration |
profile parameters
| Required | Parameter | Type | Description |
|---|---|---|---|
| Yes | media_profiles | object | Media file attributes |
| Yes | version | String | Fixed value: v1 |
Parameters in media_profiles
| Required | Parameter | Type | Description |
|---|---|---|---|
| Yes | media_data_type | String | url indicates a URL; other corresponding types indicate base64 data |
params inference parameters
params is a JSON string. Its decoded structure is as follows:
{
"rsp_media_type": "url",
"parameter": {
"media_data_type": "url",
"open_degree": 0,
"assign_degree": 80,
"sharp_degree": 5,
"more_face": 1,
"sr_rate": 1
}
}params fields
| Required | Field | Type | Description |
|---|---|---|---|
| No | rsp_media_type | String | Default: url; jpg indicates base64 data |
| Yes | parameter | Object | Core algorithm parameter object |
parameter parameters
| Required | Parameter | Type | Description |
|---|---|---|---|
| No | media_data_type | String | Image data type: • jpg: media_data is a base64-encoded image (default)• url: media_data is an image URL |
| No | open_degree | Int | Openness setting: • 1: enabled• 0: disabled (default) |
| No | assign_degree | Int | Portrait restoration intensity. Range: [0, 100]; default: 80 |
| No | skip_frames | Int[] | Frame skipping configuration: • [start, end]: number of frames to skip at the beginning and end, respectively• [0,0]: split into segments without skipping frames• None: do not split into segments (default) |
| No | sharp_degree | Int | Sharpening intensity. Range: [0, 10]; default: 5 |
| No | more_face | Int | Whether to enhance more faces: • 1: enabled (restores small or profile faces)• 0: disabled (default) |
| No | save_rate | Int | Maximum output-to-input video bitrate ratio: • 0: unlimited (default) |
| No | sr_rate | Float | Resolution upscaling factor. Default: 1 |
Request Example
{
"task": "/v1/video_super_resolution/488146",
"task_type": "formula",
"init_images": [
{
"url": "https://obs.mtlab.meitu.com/public/EtRGxLI8ulQ43pGhuZfym9aYUD2PUbMP/MTczOTUxNjQwMA==/5164853f-02af-4ce9-6c1d-fc5a68c247cd.mp4",
"profile": {
"media_profiles": {
"media_data_type": "url"
},
"version": "v1"
}
}
],
"params": "{\"rsp_media_type\":\"url\",\"parameter\":{\"media_data_type\":\"url\",\"open_degree\":0,\"assign_degree\":80,\"sharp_degree\":5,\"more_face\":1,\"sr_rate\":1}}",
"sync_timeout": 30
}Response Fields
Generated results are periodically deleted. Download and save them promptly.| Field | Type | Description |
|---|---|---|
| request_id | String | Request ID |
| trace_id | String | Trace ID |
| code | Number | HTTP-layer status code; 0 indicates success |
| error_code | Number | Business error code; 0 indicates success. See API Error Codes |
| message | String | Response message; success on success |
| tips | any | Additional information; may be null |
| data | Object | Business response data |
data fields
| Field | Type | Description |
|---|---|---|
| status | Number | -1: task not found; 0: created; 1: processing; 2: failed; 9: timed out—use the Query API; 10: succeeded |
| result | Object | Task processing result |
| progress | Number | Task progress in the range 0–1; 1 indicates completion |
| predict_elapsed | Number | Estimated processing time in milliseconds |
| create_time | Number | Task creation timestamp in milliseconds |
| task_id | String | Task ID |
| custom_task_id | String | Custom task ID |
| trace_id | String | Trace ID |
| client_info | String | Client information |
| init_images | Array | Initial input media information |
result fields
| Field | Type | Description |
|---|---|---|
| id | String | Unique task identifier |
| urls | String[] | Output media URL list |
| images | String[] | Output media (compatibility field) |
| msg | String | Response message |
| msg_id | String | Message ID |
| parameters | Object | Output parameter information |
| data | Object | Detailed processing result |
| media_info_list | Array | Media information list |
| mtlab_res | Object | Underlying service response |
result.parameters fields
| Field | Type | Description |
|---|---|---|
| rsp_media_type | String | Response media type, such as url |
| version | String | Algorithm version information |
result.data fields
| Field | Type | Description |
|---|---|---|
| duration | Object | Processing time for each stage |
| error_code | Number | Error code |
| error_msg | String | Error message |
| extra | Object | Additional information |
| media_info_list | Array | Media information list |
| msg_id | String | Message ID |
| parameter | Object | Parameter information (same as parameters) |
duration fields
| Field | Type | Description |
|---|---|---|
| alg_process_time | Number | Algorithm processing time in milliseconds |
| created_timestamp | Number | Creation time as a Unix timestamp in seconds |
| pull_timestamp | Number | Pull time |
| repost_time | Number | Retry time |
| upload_time | Number | Upload time |
| waiting_time | Number | Queueing time |
extra fields
| Field | Type | Description |
|---|---|---|
| algo_msg | Object | Internal algorithm information |
| sale_path | String | API path |
| trans_meta | Object | Transcoding information |
algo_msg fields
| Field | Type | Description |
|---|---|---|
| alg_time | Float | Algorithm execution time in seconds |
trans_meta fields
req_meta (input information)
| Field | Type | Description |
|---|---|---|
| duration | Float | Input media duration |
| media_type | String | Media type |
rsp_meta (output information)
| Field | Type | Description |
|---|---|---|
| data_rate | Float | Bitrate |
| duration | Number | Duration |
| frame_num | Number | Frame count |
| frame_rate | Number | Frame rate |
| height | Number | Height |
| width | Number | Width |
| resolution | String | Resolution, such as 480P |
| size | Number | File size in bytes |
| media_type | String | Media type |
media_info_list fields
| Field | Type | Description |
|---|---|---|
| media_data | String | Media URL |
| media_extra | Object | Additional information |
| media_profiles | Object | Media attributes |
media_profiles fields
| Field | Type | Description |
|---|---|---|
| media_data_fps | Number | Frame rate |
| media_data_height | Number | Height |
| media_data_width | Number | Width |
| media_data_size | Number | File size |
| media_data_type | String | Media type, such as url |
mtlab_res fields
| Field | Type | Description |
|---|---|---|
| ErrorCode | Number | Error code |
| ErrorMsg | String | Error message |
| error_code | Number | Error code (compatibility field) |
| error_msg | String | Error message (compatibility field) |
| media_info_list | Array | Media information |
| msg_id | String | Message ID |
| parameter | Object | Parameter information |
Response Examples
Successful Response Example
{
"request_id": "",
"trace_id": "",
"code": 0,
"error_code": 0,
"message": "success",
"tips": null,
"data": {
"status": 10,
"result": {
"id": "t_mt1a3i5n7b4bd06996-xxxx-4c99-a31c-ed25400c652a",
"urls": [
"https://obs-large.mtlab.meitu.com/mtopen/4e200dc6bf574fee899cf9e0dabe27e6/356436f0-4825-4008-6aea-d691258e6ff5.mp4"
],
"parameters": {
"rsp_media_type": "url",
"version": "HDVideo version: 2.9.1 - 更新parsing trt加速"
},
"data": {
"duration": {
"alg_process_time": 981,
"created_timestamp": 1773727956,
"pull_timestamp": 1773727956,
"repost_time": 0,
"upload_time": 52,
"waiting_time": 352
},
"error_code": 0,
"error_msg": "success",
"extra": {
"algo_msg": {
"alg_time": 0.8139691352844238
},
"sale_path": "/v2/hdvideo_async",
"trans_meta": {
"req_meta": [
{
"duration": 2222.222,
"media_type": "video"
}
],
"rsp_meta": [
{
"data_rate": 3448.156568771866,
"duration": 2222,
"frame_num": 40,
"frame_rate": 18,
"height": 512,
"media_type": "video",
"resolution": "480P",
"size": 995569,
"width": 512
}
]
}
},
"media_info_list": [
{
"media_data": "https://obs-large.mtlab.meitu.com/mtopen/4e200dc6bf574fee899cf9e0dabe27e6/356436f0-4825-4008-6aea-d691258e6ff5.mp4",
"media_extra": null,
"media_profiles": {
"media_data_fps": 18,
"media_data_height": 512,
"media_data_size": 995569,
"media_data_type": "url",
"media_data_width": 512
}
}
],
"msg_id": "38b4d91c-xxxx-4ead-6efd-r0099ef38e03",
"parameter": {
"rsp_media_type": "url",
"version": "HDVideo version: 2.9.1 - 更新parsing trt加速"
}
},
"msg": "success",
"msg_id": "38b4d91c-xxxx-4ead-6efd-r0099ef38e03",
"images": [
"https://obs-large.mtlab.meitu.com/mtopen/4e200dc6bf574fee899cf9e0dabe27e6/356436f0-4825-4008-6aea-d691258e6ff5.mp4"
],
"mtlab_res": {
"ErrorCode": 0,
"ErrorMsg": "",
"error_code": 0,
"error_msg": "",
"media_info_list": null,
"msg_id": "38b4d91c-xxxx-4ead-6efd-r0099ef38e03",
"parameter": null
},
"media_info_list": [
{
"media_data": "https://obs-large.mtlab.meitu.com/mtopen/4e200dc6bf574fee899cf9e0dabe27e6/356436f0-4825-4008-6aea-d691258e6ff5.mp4",
"media_extra": null,
"media_profiles": {
"media_data_fps": 18,
"media_data_height": 512,
"media_data_size": 995569,
"media_data_type": "url",
"media_data_width": 512
}
}
]
},
"progress": 1,
"predict_elapsed": 10000,
"create_time": 1773727956523,
"task_id": "t_mt1a3i5n7b4bd06996-xxxx-4c99-a31c-ed25400c652a",
"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": "",
"trace_id": "",
"code": 0,
"error_code": 0,
"message": "success",
"tips": null,
"data": {
"status": 9,
"result": {
"id": "t_mt1a3i5n7ba8ab7851-xxxx-4218-95a1-fcc0216ac625"
},
"progress": 0,
"predict_elapsed": 10000,
"create_time": 1773733189030,
"task_id": "t_mt1a3i5n7ba8ab7851-xxxx-4218-95a1-fcc0216ac625",
"custom_task_id": "",
"trace_id": "65280ef2-xxxx-4e3f-99a7-3db499379104",
"client_info": "",
"init_images": null
}
}Failed Response Example
Response Status: 400
Content-Type: application/json; charset=utf-8
{
"request_id": "",
"trace_id": "",
"code": 20001,
"error_code": 20001,
"message": "PROCESS_ERROR",
"tips": null,
"data": {
"status": 2,
"result": {
"error_code": 20001,
"message": "PROCESS_ERROR"
},
"progress": 0,
"predict_elapsed": 0,
"create_time": 0,
"task_id": "",
"custom_task_id": "",
"trace_id": "",
"client_info": "",
"init_images": null
}
}General Error Codes
See API Error Codes.
SDK Examples
Python
Use from sign_sdk import sign:
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": {"media_data_type": "url", "open_degree": 0, "assign_degree": 80, "sharp_degree": 5, "more_face": 1, "sr_rate": 1},
}
payload = {
"task": "/v1/video_super_resolution/488146",
"task_type": "formula",
"init_images": [
{
"url": "https://obs.mtlab.meitu.com/public/EtRGxLI8ulQ43pGhuZfym9aYUD2PUbMP/MTczOTUxNjQwMA==/5164853f-02af-4ce9-6c1d-fc5a68c247cd.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
Use github.com/mtlab/api/signer:
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/video_super_resolution/488146",
"task_type": "formula",
"init_images": [{
"url": "https://obs.mtlab.meitu.com/public/EtRGxLI8ulQ43pGhuZfym9aYUD2PUbMP/MTczOTUxNjQwMA==/5164853f-02af-4ce9-6c1d-fc5a68c247cd.mp4",
"profile": {
"media_profiles": {"media_data_type": "url"},
"version": "v1"
}
}],
"params": "{\"rsp_media_type\":\"url\",\"parameter\":{\"media_data_type\":\"url\",\"open_degree\":0,\"assign_degree\":80,\"sharp_degree\":5,\"more_face\":1,\"sr_rate\":1}}",
"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
Use signer.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' => ['media_data_type' => 'url', 'open_degree' => 0, 'assign_degree' => 80, 'sharp_degree' => 5, 'more_face' => 1, 'sr_rate' => 1],
]);
$body = json_encode([
'task' => '/v1/video_super_resolution/488146',
'task_type' => 'formula',
'init_images' => [
[
'url' => 'https://obs.mtlab.meitu.com/public/EtRGxLI8ulQ43pGhuZfym9aYUD2PUbMP/MTczOTUxNjQwMA==/5164853f-02af-4ce9-6c1d-fc5a68c247cd.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
Use the project-provided Signer, passing the actual request body to the signing method:
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/video_super_resolution/488146\",\n" +
" \"task_type\": \"formula\",\n" +
" \"init_images\": [{\n" +
" \"url\": \"https://obs.mtlab.meitu.com/public/EtRGxLI8ulQ43pGhuZfym9aYUD2PUbMP/MTczOTUxNjQwMA==/5164853f-02af-4ce9-6c1d-fc5a68c247cd.mp4\",\n" +
" \"profile\": {\n" +
" \"media_profiles\": {\"media_data_type\": \"url\"},\n" +
" \"version\": \"v1\"\n" +
" }\n" +
" }],\n" +
" \"params\": \"{\\\"rsp_media_type\\\":\\\"url\\\",\\\"parameter\\\":{\\\"media_data_type\\\":\\\"url\\\",\\\"open_degree\\\":0,\\\"assign_degree\\\":80,\\\"sharp_degree\\\":5,\\\"more_face\\\":1,\\\"sr_rate\\\":1}}\",\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);
}
}
}