Skip to main content
Video editing

Video Editing 2.7

The Wanxiang video editing model supports editing operations on input videos, such as adding, deleting, or modifying content, replacing backgrounds, converting styles, and replicating actions, effects, or camera movements. It offers the following two methods:

  • Instruction-based editing: Modify video content using text instructions, such as replacing character clothing, changing scene elements, or adjusting the visual style.
  • Instruction and reference image editing: In addition to instructions, you can pass a reference image to apply elements from the image, such as characters, clothing, or props, to the video.
For video editing, especially for replicating actions, camera movements, or effects from a specific video, use Video Editing 2.7. For video continuation capabilities, use Wanxiang Image-to-Video 2.7.

Getting started

Input prompt and reference imageInput video (effects video)Output video
Apply the special effects from the reference video to the long-haired woman in the image. The scene is a party.
image.png
Before making a call, obtain an API key and then configure the API key as an environment variable. To make calls using a software development kit (SDK), install the DashScope SDK. Replace {WorkspaceId} with your actual Workspace ID.
  • Python SDK
  • Java SDK
  • curl
Make sure that the DashScope SDK for Python version is not earlier than1.25.16 before you run the following code.An outdated version may trigger errors such as "url error, please check url!". For more information, see Install the SDK to update.
# -*- coding: utf-8 -*-
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
import os

# The following URL is for the Singapore region. Replace {WorkspaceId} with your actual workspace ID. URLs differ by region.
dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'

# If the environment variable is not set, replace the following line with your Model Studio API key: api_key="sk-xxx"
# API keys vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
api_key = os.getenv("DASHSCOPE_API_KEY")

media = [
    {
        "type": "video",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260409/eclvbm/21_refined.mp4"
    },
    {
        "type": "reference_image",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260409/jgekix/wan2.7-videoedit-demo.webp"
    }
]

def sample_sync_call():
    print('----sync call, please wait a moment----')
    rsp = VideoSynthesis.call(
        api_key=api_key,
        model="wan2.7-videoedit",
        media=media,
        resolution="720P",
        prompt_extend=True,
        watermark=True,
        prompt="Apply the special effects from the reference video to the long-haired woman in the image. The scene is a party.",
    )
    print(rsp)
    if rsp.status_code == HTTPStatus.OK:
        print(rsp.output.video_url)
    else:
        print('Failed, status_code: %s, code: %s, message: %s' %
              (rsp.status_code, rsp.code, rsp.message))

if __name__ == '__main__':
    sample_sync_call()
Sample output
video_url is valid for 24 hours. Download the video promptly.
{
    "request_id": "c1209113-8437-424f-a386-xxxxxx",
    "output": {
        "task_id": "966cebcd-dedc-4962-af88-xxxxxx",
        "task_status": "SUCCEEDED",
        "video_url": "https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx",
         ...
    },
    ...
}

Scope

  • Supported models vary by region. Resources are isolated between regions. For supported models in each region, see the Model Studio console.
  • When making a call, make sure your model, endpoint URL, and API key all belong to the same region. Cross-region calls fail.
The sample code in this topic applies to the Singapore region.

Core capabilities

Instruction-only editing

Supported model: wan2.7-videoedit. Feature introduction: This feature modifies video content based on an input video and a text prompt. It is suitable for scenarios such as style conversion, action modification, and camera movement adjustments. Parameter settings:
  • media: Specifies the video to be edited (type=video). You do not need to provide a reference image.
  • prompt: Describe the editing intent, such as "Change the video to an 8-bit pixel style".
Input promptInput videoOutput video
Change the video to an 8-bit pixel style
Replace {WorkspaceId} with your actual Workspace ID.
  • Python SDK
  • Java SDK
  • curl
Make sure that the DashScope SDK for Python version is not earlier than1.25.16 before you run the following code.An outdated version may trigger errors such as "url error, please check url!". For more information, see Install the SDK to update.
# -*- coding: utf-8 -*-
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
import os

# The following URL is for the Singapore region. Replace {WorkspaceId} with your actual workspace ID. URLs differ by region.
dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'

# If the environment variable is not set, replace the following line with your Model Studio API key: api_key="sk-xxx"
# API keys vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
api_key = os.getenv("DASHSCOPE_API_KEY")

media = [
    {
        "type": "video",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260402/ldnfdf/wan2.7-videoedit-style-change.mp4"
    }
]

def sample_sync_call():
    print('----sync call, please wait a moment----')
    rsp = VideoSynthesis.call(
        api_key=api_key,
        model="wan2.7-videoedit",
        media=media,
        resolution="720P",
        prompt_extend=True,
        watermark=True,
        prompt="Convert the entire frame to a claymation style",
    )
    if rsp.status_code == HTTPStatus.OK:
        print(rsp.output.video_url)
    else:
        print('Failed, status_code: %s, code: %s, message: %s' %
              (rsp.status_code, rsp.code, rsp.message))

if __name__ == '__main__':
    sample_sync_call()

Instruction and reference image editing

Supported model: wan2.7-videoedit. Feature introduction: This feature applies elements from a reference image, such as clothing or props, to a video based on a text prompt. Parameter settings:
  • media: Specifies the video to be edited (type=video) and a reference image (type=reference_image). You can provide up to four reference images.
  • prompt: Describe the editing intent, such as "Make the horse-headed character in the video wear the striped sweater from the image".
Input prompt and reference imageInput videoOutput video
Make the horse-headed character in the video wear the striped sweater from the image
2560154123_RF-jpeg
Replace {WorkspaceId} with your actual Workspace ID.
  • Python SDK
  • Java SDK
  • curl
Make sure that the DashScope SDK for Python version is not earlier than1.25.16 before you run the following code.An outdated version may trigger errors such as "url error, please check url!". For more information, see Install the SDK to update.
# -*- coding: utf-8 -*-
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
import os

# The following URL is for the Singapore region. Replace {WorkspaceId} with your actual workspace ID. URLs differ by region.
dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'

# If the environment variable is not set, replace the following line with your Model Studio API key: api_key="sk-xxx"
# API keys vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
api_key = os.getenv("DASHSCOPE_API_KEY")

media = [
    {
        "type": "video",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260403/nlspwm/T2VA_22.mp4"
    },
    {
        "type": "reference_image",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260402/fwjpqf/wan2.7-videoedit-change-clothes.png"
    }
]

def sample_sync_call():
    print('----sync call, please wait a moment----')
    rsp = VideoSynthesis.call(
        api_key=api_key,
        model="wan2.7-videoedit",
        media=media,
        resolution="720P",
        prompt_extend=True,
        watermark=True,
        prompt="Replace the girl's clothes in the video with the clothes from the image",
    )
    if rsp.status_code == HTTPStatus.OK:
        print(rsp.output.video_url)
    else:
        print('Failed, status_code: %s, code: %s, message: %s' %
              (rsp.status_code, rsp.code, rsp.message))

if __name__ == '__main__':
    sample_sync_call()

Scenarios and examples

Add, delete, or modify elements

Add, delete, or replace specific elements within a video.
TypeInput prompt and reference imageInput videoOutput video
AddAdd a black square piece of chocolate to the cup
DeleteRemove the train from the video. Keep everything else the same.
ModifyReplace the film in the video with the plate from the image
image.png
ModifyMake the horse man in the video wear the striped sweater from the image
2560154123_RF-jpeg
ModifyChange the cat to a dog

Modify the environment or background

Use instructions to change the lighting conditions, seasonal colors, or geographical space of a video. You can also change the video background to transport objects to any space.
TypeInput promptInput videoOutput video
Modify seasonChange the background season to a snowy winter, with snow covering the trees. Keep the river the same.
Modify weatherKeep the character's actions the same, but change the entire scene from the current cloudy day to a sunny day. Keep everything else the same.
Modify lighting and shadowKeep everything else the same. Change the overall light color and filter of the frame from white to a warm tone. Maintain the details of the character's skin tone to create a harmonious look between the character and the background.
Modify backgroundKeep the main woman's actions the same, but change the video background to a gym.

Modify the video style

Quickly convert existing videos into various artistic styles, such as animation, 3D, claymation, or yarn.
TypeInput promptInput videoOutput video
Modify styleVideo-to-Image: C4D Cartoon Style
2402534429_RF
Modify styleConvert the entire frame to a live-action movie style
Modify styleConvert the entire frame to a watercolor painting style

Modify character behavior, lines, or camera work

For existing or generated video content, you can use instructions to modify the plot, such as character behavior or dialogue, and adjust camera work for further creative editing.
TypeInput promptInput videoOutput video
Modify character behaviorMake the man in the video take a spoonful of soup and drink it. Keep everything else the same.
Modify character emotionThe girl's expression in the frame becomes sad and she starts to cry. Keep everything else the same.
Modify character linesKeep the character's voice and tone. Change the left girl's line to: "Mom, what color is this?", and change the right girl's line to: "It's green, baby"
Modify camera workChange the camera movement to a clockwise orbit around the character, with the character following the camera's movement.
Modify camera workChange the video's camera movement to a tilt-up while simultaneously looking down.

Replicate actions, camera movements, or effects

Replicate the action sequences, camera trajectories, and visual effects of a reference video to generate a video with consistent dynamic features.
TypeInput prompt or reference imageInput videoOutput video
Replicate single-person actionMake the person in the image imitate the actions of the person in the video.
image.png
Replicate multi-person actionReference the actions of the five people in the video, and change the scene to five people singing and playing instruments at a roadside stall in a city street.
Replicate camera movementReference the camera movement of the original video with fast camera motion. Change the scene to an awards ceremony, with the woman from the reference image walking the red carpet.
image.png
Replicate effectsReference the special effects of the video and apply them to the woman in the image, with the scene set on a street.
image.png

How to input videos and images

Input video

  • Video quantity: Required. Exactly one.
  • Input method:

Input reference image

  • Image quantity: Optional. Up to four.
  • Input method:
    • Public URL: Supports HTTP or HTTPS protocols. Example: https://xxxx/xxx.png.
    • Base64-encoded string: Example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABDg...... (Example truncated for demonstration purposes).
      • Format: data:{MIME_type};base64,{base64_data}, where:
        • {base64_data}: The Base64-encoded string of the image file.
        • {MIME_type}: The media type of the image, which must correspond to the file format.

        Image format

        MIME Type

        JPEG

        image/jpeg

        JPG

        image/jpeg

        PNG

        image/png

        BMP

        image/bmp

        WEBP

        image/webp

        import base64
        import mimetypes
        
        # Format is data:{MIME_type};base64,{base64_data}
        def encode_file(file_path):
            mime_type, _ = mimetypes.guess_type(file_path)
            if not mime_type or not mime_type.startswith("image/"):
                raise ValueError("Unsupported or unrecognized image format")
            with open(file_path, "rb") as image_file:
                encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
            return f"data:{mime_type};base64,{encoded_string}"
        
        # Replace your_image.jpg with the actual image path
        base64_str = encode_file("your_image.jpg")
        print(base64_str)
        

Output video

Billing and rate limiting

  • For model free quotas and billing prices, see Model pricing.
  • For model rate limits, see Wanxiang series.
  • Billing description:
    • Input images are not billed. Input videos and output videos are billed by the second. The formula is: Total billable duration (seconds) = Input video duration (seconds) + Output video duration (seconds).
    • Failed model calls or processing errors do not incur any fees and do not consume the free quota for new users.

API documentation

Wanxiang Video Editing 2.7

FAQ

Q: What is the difference between Video Editing 2.7 (wan2.7-videoedit) and Video Editing 2.1 (wan2.1-vace-plus)?

A: Video Editing 2.7 edits videos directly based on instructions, which is simpler to use and offers comprehensive upgrades. Video Editing 2.1 requires you to specify the function parameter and focuses on features such as local editing with masks and frame expansion. We recommend that you use Video Editing 2.7.

Q: How do I input multiple reference images?

A: You can add multiple objects with type=reference_image to the media array. You can add up to four reference images. Example:
{
    "media": [
        {"type": "video", "url": "<Input video URL>"},
        {"type": "reference_image", "url": "<Reference image 1 URL>"},
        {"type": "reference_image", "url": "<Reference image 2 URL>"},
        {"type": "reference_image", "url": "<Reference image 3 URL>"},
        {"type": "reference_image", "url": "<Reference image 4 URL>"}
    ]
}
Token Plan
Model Playground
Statistics and Monitoring
Support
Video Editing 2.7 - Alibaba Cloud Model Studio