QwenCloudBRASIL
Tradução de apoio para consulta. Código e identificadores técnicos preservados. Consultar referência original ↗

Wan — Recuperar resultado de edição de vídeo

Verifique o status de edição do vídeo

Estratégia de votação

  1. Ligue para Editar um vídeo para obter um task_id.
  2. Pesquise este endpoint a cada 15 segundos até task_status é SUCCEEDED ou FAILED.
  3. Se tiver sucesso, baixe o vídeo do video_url campo.

Notas

OpenAPI

openapi: 3.1.0
info:
  title: Wan General Video Editing API
  description: "Wan unified video editing API. Supports multimodal input (text, image, video) with five core capabilities: multi-image reference, video repainting, local editing, video extension, and frame expansion."
  version: 1.0.0
servers:
  - url: https://maas.qwencloudapi.com/api/v1
    description: Singapore
security:
  - BearerAuth: []
paths:
  /tasks/{task_id}:
    get:
      operationId: getVideoEditingTaskStatus
      summary: Query task result
      description: Query the status and result of the video editing task.
      parameters:
        - name: task_id
          in: path
          required: true
          description: Task identifier returned by the video editing creation endpoint.
          schema:
            type: string
      responses:
        "200":
          description: Task status retrieved successfully.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TaskStatusResponse"
              examples:
                SUCCEEDED:
                  summary: Task succeeded
                  value:
                    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
                      task_metrics:
                        TOTAL: 1
                        SUCCEEDED: 1
                        FAILED: 0
                    usage:
                      video_count: 1
                      video_duration: 5
                FAILED:
                  summary: Task failed
                  value:
                    request_id: c1209113-8437-424f-a386-xxxxxx
                    output:
                      task_id: 966cebcd-dedc-4962-af88-xxxxxx
                      task_status: FAILED
                      code: InvalidParameter
                      message: The specified parameter is not valid.
                      task_metrics:
                        TOTAL: 1
                        SUCCEEDED: 0
                        FAILED: 1
                RUNNING:
                  summary: Task running
                  value:
                    request_id: c1209113-8437-424f-a386-xxxxxx
                    output:
                      task_id: 966cebcd-dedc-4962-af88-xxxxxx
                      task_status: RUNNING
                      task_metrics:
                        TOTAL: 1
                        SUCCEEDED: 0
                        FAILED: 0
        "400":
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DashScopeErrorResponse"
      x-codeSamples:
        - lang: curl
          label: cURL - Query task result
          source: |-
            # Replace {task_id} with the actual task ID from the submit response
            curl -X GET 'https://maas.qwencloudapi.com/api/v1/tasks/{task_id}' \
              -H "Authorization: Bearer $DASHSCOPE_API_KEY"
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: DashScope API Key. Create one in the [QwenCloud console](https://home.qwencloud.com/api-keys).
  schemas:
    VideoEditingRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: Model name.
          enum:
            - wan2.1-vace-plus
          example: wan2.1-vace-plus
        input:
          $ref: "#/components/schemas/VideoEditingInput"
        parameters:
          $ref: "#/components/schemas/VideoEditingParameters"
    VideoEditingInput:
      type: object
      required:
        - function
        - prompt
      description: Input data for video editing. Required fields vary by function.
      properties:
        function:
          type: string
          description: The video editing capability to use.
          enum:
            - image_reference
            - video_repainting
            - video_edit
            - video_extension
            - video_outpainting
          example: image_reference
        prompt:
          type: string
          description: Text description of the desired video content.
          example: In the video, a girl walks out from the depths of an ancient, misty forest.
        ref_images_url:
          type: array
          description: Array of reference image URLs. Used by `image_reference` (1-3 images) and optionally by `video_repainting` and `video_edit` (1 image to replace subject).
          items:
            type: string
            format: uri
          minItems: 1
          maxItems: 3
          example:
            - http://wanx.alicdn.com/material/20250318/image_reference_2_5_16.png
            - http://wanx.alicdn.com/material/20250318/image_reference_1_5_16.png
        video_url:
          type: string
          format: uri
          description: URL of the input video. Required for `video_repainting`, `video_edit`, and `video_outpainting`. Must be MP4 format, no larger than 50 MB, and no longer than 5 seconds.
          example: http://wanx.alicdn.com/material/20250318/video_repainting_1.mp4
        mask_image_url:
          type: string
          format: uri
          description: URL of a mask image for `video_edit`. White areas are edited; black areas remain unchanged. Specify either this or `mask_video_url`.
        mask_video_url:
          type: string
          format: uri
          description: URL of a mask video for `video_edit`. Specify either this or `mask_image_url`. Using `mask_image_url` is recommended.
        mask_frame_id:
          type: integer
          description: "For `video_edit` with `mask_image_url`: specifies which video frame the mask corresponds to. Default: first frame (0)."
          default: 0
          example: 1
        first_clip_url:
          type: string
          format: uri
          description: "For `video_extension`: URL of the first video clip (3 seconds or shorter). The model generates the rest of the video based on this clip."
        last_clip_url:
          type: string
          format: uri
          description: "For `video_extension`: URL of the last video clip (3 seconds or shorter). The model generates the preceding content."
        first_frame_url:
          type: string
          format: uri
          description: "For `video_extension`: URL of the first frame image. The video extends forward from this frame."
        last_frame_url:
          type: string
          format: uri
          description: "For `video_extension`: URL of the last frame image. Generation proceeds backward from this frame."
    VideoEditingParameters:
      type: object
      description: Generation parameters for video editing. Available parameters vary by function.
      properties:
        prompt_extend:
          type: boolean
          description: "Enable prompt rewriting. `true` (default): model optimizes your prompt. `false`: use your prompt as-is. We recommend disabling this for `video_repainting`."
          default: true
        size:
          type: string
          description: Output resolution as `width*height`. Used by `image_reference` and `video_edit`.
          example: 1280*720
        obj_or_bg:
          type: array
          description: "For `image_reference`: identifies each reference image as a subject (`obj`) or background (`bg`). Array length must match `ref_images_url` length."
          items:
            type: string
            enum:
              - obj
              - bg
          example:
            - obj
            - bg
        control_condition:
          type: string
          description: "For `video_repainting`: video feature extraction method. Determines which features from the original video are retained."
          enum:
            - posebodyface
            - posebody
            - depth
            - scribble
          example: depth
        strength:
          type: number
          description: "For `video_repainting`: controls feature extraction strength. Higher values make the output more similar to the original; lower values allow more creative freedom."
          minimum: 0
          maximum: 1
          default: 1
        mask_type:
          type: string
          description: "For `video_edit`: specifies the behavior of the editing area. `tracking` (default): the editing area automatically follows the target's motion. `fixed`: the editing area stays in a fixed position."
          enum:
            - tracking
            - fixed
          default: tracking
        expand_ratio:
          type: number
          description: "For `video_edit` with `mask_type: tracking`: the ratio by which the mask area expands outward. Lower values fit the target more closely; higher values expand the mask area."
          minimum: 0
          maximum: 1
          default: 0.05
        top_scale:
          type: number
          description: "For `video_outpainting`: upward expansion ratio. Setting to 1.5 expands the top to 1.5 times original height."
          minimum: 1
          maximum: 2
          default: 1
        bottom_scale:
          type: number
          description: "For `video_outpainting`: downward expansion ratio."
          minimum: 1
          maximum: 2
          default: 1
        left_scale:
          type: number
          description: "For `video_outpainting`: leftward expansion ratio."
          minimum: 1
          maximum: 2
          default: 1
        right_scale:
          type: number
          description: "For `video_outpainting`: rightward expansion ratio."
          minimum: 1
          maximum: 2
          default: 1
    AsyncTaskSubmitResponse:
      type: object
      description: Response returned when an asynchronous task is created successfully.
      properties:
        request_id:
          type: string
          description: Unique request identifier.
        output:
          type: object
          properties:
            task_id:
              type: string
              description: Task identifier. Use this with `GET /tasks/{task_id}` to poll for results.
            task_status:
              type: string
              description: Initial task status, typically `PENDING`.
              enum:
                - PENDING
    TaskStatusResponse:
      type: object
      description: Response containing the current status and results of a video editing task.
      properties:
        request_id:
          type: string
          description: Unique request identifier.
        output:
          type: object
          properties:
            task_id:
              type: string
              description: Task identifier.
            task_status:
              type: string
              description: Current task status.
              enum:
                - PENDING
                - RUNNING
                - SUCCEEDED
                - FAILED
                - CANCELLED
            video_url:
              type: string
              format: uri
              description: Generated video URL. Only present when `task_status` is `SUCCEEDED`. Valid for 24 hours — download promptly.
            code:
              type: string
              description: Error code. Only present when `task_status` is `FAILED`.
            message:
              type: string
              description: Error message. Only present when `task_status` is `FAILED`.
        usage:
          type: object
          description: Usage statistics (only present when task succeeds).
          properties:
            video_count:
              type: integer
              description: Number of videos generated.
            video_duration:
              type: integer
              description: Duration of the generated video in seconds.
    DashScopeErrorResponse:
      type: object
      description: DashScope API error response.
      properties:
        request_id:
          type: string
          description: Unique request identifier.
        code:
          type: string
          description: Error code (e.g., `InvalidParameter`, `Throttling`, `Unauthorized`).
          example: InvalidParameter
        message:
          type: string
          description: Human-readable error message.
          example: "Invalid parameter: function"