Skip to main content
Video gen & edits

Video style transform

Repaint a video in an artistic style such as Japanese manga or 3D cartoon

video-style-transform repaints each frame of a video in an artistic style while preserving the appearance of people and objects. It supports eight styles. Quick links: API reference: Create a task, Query the result Supported regions: China North 2 (Beijing) only. Use an API key created in that region and the https://cn-beijing.maas.qwencloudapi.com endpoint. See Regions and endpoints.

Supported styles

Style codeStyleNotes
0Japanese mangaDefault
1American comic
2Fresh comic
33D cartoon
4Chinese cartoonBest for inputs with ancient costumes
5Paper art
6Simple illustration
7Chinese ink wash painting

Input video requirements

ConstraintRequirement
ResolutionEach side between 256 and 4,096 pixels. Aspect ratio no more than 1.8.
FormatMP4, AVI, MKV, MOV, FLV, TS, MPG, MXF
DurationUp to 30 seconds
File sizeUp to 100 MB
EncodingH.264 or H.265
URLURL-encode paths that contain non-ASCII characters.

Request example

import os
import time
import requests

# China North 2 (Beijing). This model is available only in this region.
# API keys are region-specific. See https://docs.qwencloud.com/developer-guides/getting-started/regions
BASE_URL = "https://cn-beijing.maas.qwencloudapi.com/api/v1"
headers = {
  "Authorization": f"Bearer {os.getenv('DASHSCOPE_API_KEY')}",
  "Content-Type": "application/json",
  "X-DashScope-Async": "enable",
}

response = requests.post(
  f"{BASE_URL}/services/aigc/video-generation/video-synthesis",
  headers=headers,
  json={
    "model": "video-style-transform",
    "input": {"video_url": "https://example.com/input.mp4"},
    "parameters": {"style": 0, "video_fps": 15}
  },
)
task_id = response.json()["output"]["task_id"]

while True:
  result = requests.get(f"{BASE_URL}/tasks/{task_id}", headers=headers).json()
  status = result["output"]["task_status"]
  if status in ("SUCCEEDED", "FAILED"):
    break
  time.sleep(10)

print(result)

Parameters

ParameterTypeDefaultDescription
styleinteger0Artistic style. Valid values: 0-7. See Supported styles.
video_fpsinteger15Output frame rate. Range: 15-25. A higher frame rate produces smoother video and increases the billed duration.
animate_emotionbooleantrueOptimizes facial expressions and lip sync. Disable it when faces occupy a small area.
min_leninteger720Short side of the output video in pixels. Valid values: 720 and 540. A 720p video costs more than a 540p video.
use_SRbooleanfalseApplies super-resolution after the style transform at no extra cost. Combining min_len 540 with SR produces a 1080p video billed at the 540p rate. Processing takes longer.

Billing

You are charged only for successful tasks. The fee is calculated from the output video duration and resolution:
ResolutionUnit price
720p$0.071677/second
540p$0.028671/second
For example, a 10-second 720p video costs 10 x $0.071677 = $0.71677.

FAQ

How long does a task take? A 30-second input video typically takes several minutes. Poll the task status every 10 seconds or more. Can I use super-resolution to get 1080p output? Yes. Set min_len to 540 and use_SR to true. The output is upscaled to 1080p and billed at the 540p rate.
Video style transform - QwenCloud