# SEE2AI 时间线剪辑

> Assemble clips, voice, music, images, text, and subtitle files on a multi-track timeline into one rendered video or audio file through an asynchronous submit-and-poll workflow. Supports trims, per-element volume, fades, placement, cropping, speed, text presets, text animations, and adjacent-video transitions.

## 📖 接入指引

**Endpoint**: `POST /api/v1/actions/see2ai_media_timeline_edit_v1`

**认证方式**: Bearer Token (租户 API Key)

### Endpoints

| Method | Path | Purpose |
| --- | --- | --- |
| `POST` | `/api/v1/actions/see2ai_media_timeline_edit_v1` | Submit the standard action request. |

> **⚠️ 重要提示**
> 
> 本 API 是 SEE2AI 平台标准化封装后的接口，**参数格式与任何上游 API 不同**。
> 请直接使用下方 Schema 中定义的参数，无需参考其他文档。
> 
> *例如：*
> *- 文本模型参数可能是 `query` 而不是 `messages` 数组*
> *- 视频模型参数可能是 `brief` (创意简报) 而不是复杂的配置项*

## 📥 输入参数 (Input Schema)

```json
{
  "$defs": {
    "TimelineCanvas": {
      "additionalProperties": true,
      "properties": {
        "width": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output width in pixels (160-8192).",
          "title": "Width"
        },
        "height": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output height in pixels (160-8192).",
          "title": "Height"
        },
        "background_color": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "RGBA hex canvas background such as #000000FF.",
          "title": "Background Color"
        }
      },
      "title": "TimelineCanvas",
      "type": "object"
    },
    "TimelineElement": {
      "additionalProperties": true,
      "properties": {
        "type": {
          "description": "Element type: video, audio, image, text, or subtitle.",
          "title": "Type",
          "type": "string"
        },
        "target_time": {
          "description": "Placement on the output timeline as [start_ms, end_ms].",
          "items": {
            "type": "integer"
          },
          "title": "Target Time",
          "type": "array"
        },
        "source": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "video/audio/image: public HTTP(S) media URL.",
          "title": "Source"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text: the words to render; subtitle: a public HTTP(S) SRT file URL.",
          "title": "Text"
        },
        "loop": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "video/audio/image: repeat the media when it is shorter than its placement.",
          "title": "Loop"
        },
        "font_type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text/subtitle: font id (SY_Black, ALi_PuHui, PM_ZhengDao, 1187211, 1187213, 1187217, 1187219, 1187221, 1187223, 1187225) or a public TTF/OTF URL. Defaults to SY_Black (Source Han Sans).",
          "title": "Font Type"
        },
        "text_res": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text only: documented decorative text preset ID.",
          "title": "Text Res"
        },
        "font_size": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text/subtitle: font size in pixels.",
          "title": "Font Size"
        },
        "font_color": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text/subtitle: RGBA hex color such as #FFFFFFFF.",
          "title": "Font Color"
        },
        "bold": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text/subtitle: bold text.",
          "title": "Bold"
        },
        "italic": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text/subtitle: italic text.",
          "title": "Italic"
        },
        "underline": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text/subtitle: underlined text.",
          "title": "Underline"
        },
        "background_color": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text/subtitle: RGBA hex background behind the text.",
          "title": "Background Color"
        },
        "background_border_size": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text/subtitle: background padding size, 0 or more.",
          "title": "Background Border Size"
        },
        "border_color": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text/subtitle: RGBA hex outline color.",
          "title": "Border Color"
        },
        "border_width": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text/subtitle: outline width, at least 1 and at most 10% of the font size.",
          "title": "Border Width"
        },
        "line_max_width": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text/subtitle: -1 disables wrapping; a value in (0, 1] wraps at that share of the box.",
          "title": "Line Max Width"
        },
        "typesetting": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text/subtitle: 0 horizontal (default), 1 vertical.",
          "title": "Typesetting"
        },
        "align_type": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text/subtitle: horizontal 0 left, 1 center, 2 right; vertical 1 center, 3 top, 4 bottom.",
          "title": "Align Type"
        },
        "extra": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/TimelineFilter"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Filters applied to this element. text and subtitle require exactly one transform.",
          "title": "Extra"
        }
      },
      "required": [
        "type",
        "target_time"
      ],
      "title": "TimelineElement",
      "type": "object"
    },
    "TimelineFilter": {
      "additionalProperties": true,
      "properties": {
        "type": {
          "description": "Filter type: trim, a_volume, a_fade, transform, crop, speed, text_animation, or transition.",
          "title": "Type",
          "type": "string"
        },
        "start_time": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "trim: source start time in milliseconds.",
          "title": "Start Time"
        },
        "end_time": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "trim: source end time in milliseconds.",
          "title": "End Time"
        },
        "volume": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "a_volume: volume multiplier from 0 (mute) to 10; 1 keeps the original level.",
          "title": "Volume"
        },
        "fade_in": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "a_fade: fade-in length in milliseconds.",
          "title": "Fade In"
        },
        "fade_out": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "a_fade: fade-out length in milliseconds.",
          "title": "Fade Out"
        },
        "pos_x": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "transform/crop: horizontal offset in pixels.",
          "title": "Pos X"
        },
        "pos_y": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "transform/crop: vertical offset in pixels.",
          "title": "Pos Y"
        },
        "width": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "transform/crop: width in pixels.",
          "title": "Width"
        },
        "height": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "transform/crop: height in pixels.",
          "title": "Height"
        },
        "rotation": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "transform: clockwise rotation in degrees, -360 to 360.",
          "title": "Rotation"
        },
        "flip_x": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "transform: mirror horizontally.",
          "title": "Flip X"
        },
        "flip_y": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "transform: mirror vertically.",
          "title": "Flip Y"
        },
        "alpha": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "transform: opacity from 0 (transparent) to 1.",
          "title": "Alpha"
        },
        "speed": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "speed: playback rate from 0.1 to 4; trim is applied to the source before speed.",
          "title": "Speed"
        },
        "source": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "transition: documented preset resource ID.",
          "title": "Source"
        },
        "duration": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "transition: positive duration in milliseconds.",
          "title": "Duration"
        },
        "anim_in_res": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text_animation: documented entrance resource ID.",
          "title": "Anim In Res"
        },
        "anim_in_duration": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Entrance duration in milliseconds.",
          "title": "Anim In Duration"
        },
        "anim_out_res": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text_animation: documented exit resource ID.",
          "title": "Anim Out Res"
        },
        "anim_out_duration": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Exit duration in milliseconds.",
          "title": "Anim Out Duration"
        },
        "anim_loop_res": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "text_animation: documented loop resource ID.",
          "title": "Anim Loop Res"
        },
        "anim_loop_duration": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Loop duration in milliseconds.",
          "title": "Anim Loop Duration"
        }
      },
      "required": [
        "type"
      ],
      "title": "TimelineFilter",
      "type": "object"
    },
    "TimelineOutput": {
      "additionalProperties": true,
      "properties": {
        "format": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "mp4 (default, video) or mp3 (audio only).",
          "title": "Format"
        },
        "fps": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output frame rate, 1-60 (default 30).",
          "title": "Fps"
        },
        "disable_video": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Render audio only. Implied by format mp3.",
          "title": "Disable Video"
        },
        "disable_audio": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Render video without audio.",
          "title": "Disable Audio"
        }
      },
      "title": "TimelineOutput",
      "type": "object"
    }
  },
  "additionalProperties": true,
  "description": "One timeline render request.",
  "examples": [
    {
      "aigc_meta": {
        "ContentProducer": "your-app",
        "Label": "1",
        "ProduceID": "cut-1"
      },
      "canvas": {
        "height": 1920,
        "width": 1080
      },
      "tracks": [
        [
          {
            "extra": [
              {
                "end_time": 4000,
                "start_time": 0,
                "type": "trim"
              }
            ],
            "source": "https://cdn.example.com/uploads/shot-1.mp4",
            "target_time": [
              0,
              4000
            ],
            "type": "video"
          },
          {
            "extra": [
              {
                "end_time": 5000,
                "start_time": 1000,
                "type": "trim"
              }
            ],
            "source": "https://cdn.example.com/uploads/shot-2.mp4",
            "target_time": [
              4000,
              8000
            ],
            "type": "video"
          }
        ],
        [
          {
            "source": "https://cdn.example.com/uploads/voice.m4a",
            "target_time": [
              0,
              8000
            ],
            "type": "audio"
          }
        ],
        [
          {
            "extra": [
              {
                "type": "a_volume",
                "volume": 0.3
              },
              {
                "fade_in": 300,
                "fade_out": 800,
                "type": "a_fade"
              }
            ],
            "source": "https://cdn.example.com/uploads/music.mp3",
            "target_time": [
              0,
              8000
            ],
            "type": "audio"
          }
        ],
        [
          {
            "align_type": 1,
            "extra": [
              {
                "height": 160,
                "pos_x": 90,
                "pos_y": 1560,
                "type": "transform",
                "width": 900
              }
            ],
            "font_size": 64,
            "target_time": [
              0,
              4000
            ],
            "text": "First subtitle line",
            "type": "text"
          }
        ]
      ]
    }
  ],
  "properties": {
    "tracks": {
      "description": "Timeline tracks; each track is a list of elements. Higher tracks render on top of lower ones, and audio from every track is mixed.",
      "items": {
        "items": {
          "$ref": "#/$defs/TimelineElement"
        },
        "type": "array"
      },
      "title": "Tracks",
      "type": "array"
    },
    "canvas": {
      "anyOf": [
        {
          "$ref": "#/$defs/TimelineCanvas"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Output size and background. Required for video output, e.g. 1080x1920."
    },
    "output": {
      "anyOf": [
        {
          "$ref": "#/$defs/TimelineOutput"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Container and stream switches. Omit for an mp4 video with audio at 30 fps."
    },
    "aigc_meta": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional AI-generated content labeling fields embedded in the output file: Label, ContentProducer, ProduceID, ReservedCode1, ContentPropagator, PropagateID, ReservedCode2 (string values), as an object or its JSON string.",
      "title": "Aigc Meta"
    },
    "idempotency_key": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional caller key (1-128 printable ASCII; must match X-Idempotency-Key when both are sent) that makes resubmission safe.",
      "title": "Idempotency Key"
    }
  },
  "required": [
    "tracks"
  ],
  "title": "ActionInput",
  "type": "object"
}
```

### 参数说明

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| `tracks` | array | ✅ 是 | `-` | Timeline tracks; each track is a list of elements. Higher tracks render on top of lower ones, and audio from every track is mixed. |
| `canvas` | object / null | ❌ 否 | `-` | Output size and background. Required for video output, e.g. 1080x1920. |
| `output` | object / null | ❌ 否 | `-` | Container and stream switches. Omit for an mp4 video with audio at 30 fps. |
| `aigc_meta` | object / string / null | ❌ 否 | `-` | Optional AI-generated content labeling fields embedded in the output file: Label, ContentProducer, ProduceID, ReservedCode1, ContentPropagator, PropagateID, ReservedCode2 (string values), as an object or its JSON string. |
| `idempotency_key` | string / null | ❌ 否 | `-` | Optional caller key (1-128 printable ASCII; must match X-Idempotency-Key when both are sent) that makes resubmission safe. |

## 📤 输出结果 (Output Schema)

```json
{
  "properties": {
    "input_tokens": {
      "default": 0,
      "description": "输入消耗的词元数量",
      "title": "Input Tokens",
      "type": "integer"
    },
    "output_tokens": {
      "default": 0,
      "description": "输出消耗的词元数量",
      "title": "Output Tokens",
      "type": "integer"
    },
    "total_tokens": {
      "default": 0,
      "description": "总消耗的词元数量",
      "title": "Total Tokens",
      "type": "integer"
    },
    "model": {
      "default": "",
      "description": "实际使用的 SEE2AI 化身模型名称（由各 action 显式填写）",
      "title": "Model",
      "type": "string"
    },
    "source": {
      "default": "see2ai",
      "description": "服务来源（统一 `see2ai`；真实路由仅平台内部可见）",
      "title": "Source",
      "type": "string"
    },
    "cost_points": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "预先计算的扣费词元（如果插件内部已经计算好费用，则直接使用此值，忽略基于词元的计算）",
      "title": "Cost Points"
    },
    "task_id": {
      "description": "Opaque task ID used for status polling.",
      "title": "Task Id",
      "type": "string"
    },
    "status": {
      "description": "Normalized task status: running, success, or failed.",
      "enum": [
        "running",
        "success",
        "failed"
      ],
      "title": "Status",
      "type": "string"
    },
    "result_urls": {
      "description": "Durable result URLs, empty until success.",
      "items": {
        "type": "string"
      },
      "title": "Result Urls",
      "type": "array"
    },
    "estimated_cost": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Maximum platform points held until settlement.",
      "title": "Estimated Cost"
    },
    "retryable": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Whether a non-terminal status should be polled again.",
      "title": "Retryable"
    },
    "retry_after_seconds": {
      "anyOf": [
        {
          "minimum": 1,
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Suggested wait before the next poll.",
      "title": "Retry After Seconds"
    },
    "error_message": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Brand-safe failure or retry guidance.",
      "title": "Error Message"
    },
    "warnings": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Non-blocking optimization suggestions produced by validation.",
      "title": "Warnings"
    },
    "video_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Durable rendered video URL when the output is video.",
      "title": "Video Url"
    },
    "audio_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Durable rendered audio URL when the output is audio only.",
      "title": "Audio Url"
    },
    "duration": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Rendered output duration in seconds (the billed usage).",
      "title": "Duration"
    },
    "resolution": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Rendered output resolution label, such as 1080p.",
      "title": "Resolution"
    }
  },
  "required": [
    "task_id",
    "status"
  ],
  "title": "TimelineEditStatusOutput",
  "type": "object"
}
```

### 输出字段说明

| 字段名 | 类型 | 说明 |
|--------|------|------|
| `input_tokens` | integer | 输入消耗的词元数量 |
| `output_tokens` | integer | 输出消耗的词元数量 |
| `total_tokens` | integer | 总消耗的词元数量 |
| `model` | string | 实际使用的 SEE2AI 化身模型名称（由各 action 显式填写） |
| `source` | string | 服务来源（统一 `see2ai`；真实路由仅平台内部可见） |
| `cost_points` | integer / null | 预先计算的扣费词元（如果插件内部已经计算好费用，则直接使用此值，忽略基于词元的计算） |
| `task_id` | string | Opaque task ID used for status polling. |
| `status` | string enum | Normalized task status: running, success, or failed. |
| `result_urls` | array | Durable result URLs, empty until success. |
| `estimated_cost` | integer / null | Maximum platform points held until settlement. |
| `retryable` | boolean / null | Whether a non-terminal status should be polled again. |
| `retry_after_seconds` | integer / null | Suggested wait before the next poll. |
| `error_message` | string / null | Brand-safe failure or retry guidance. |
| `warnings` | array / null | Non-blocking optimization suggestions produced by validation. |
| `video_url` | string / null | Durable rendered video URL when the output is video. |
| `audio_url` | string / null | Durable rendered audio URL when the output is audio only. |
| `duration` | number / null | Rendered output duration in seconds (the billed usage). |
| `resolution` | string / null | Rendered output resolution label, such as 1080p. |

## 💡 调用示例

### cURL 示例

```bash
curl -X POST "https://see2ai.com/api/v1/actions/see2ai_media_timeline_edit_v1" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer sk-your-tenant-api-key" \
     -d '{
  "aigc_meta": {
    "ContentProducer": "your-app",
    "Label": "1",
    "ProduceID": "cut-1"
  },
  "canvas": {
    "height": 1920,
    "width": 1080
  },
  "tracks": [
    [
      {
        "extra": [
          {
            "end_time": 4000,
            "start_time": 0,
            "type": "trim"
          }
        ],
        "source": "https://cdn.example.com/uploads/shot-1.mp4",
        "target_time": [
          0,
          4000
        ],
        "type": "video"
      },
      {
        "extra": [
          {
            "end_time": 5000,
            "start_time": 1000,
            "type": "trim"
          }
        ],
        "source": "https://cdn.example.com/uploads/shot-2.mp4",
        "target_time": [
          4000,
          8000
        ],
        "type": "video"
      }
    ],
    [
      {
        "source": "https://cdn.example.com/uploads/voice.m4a",
        "target_time": [
          0,
          8000
        ],
        "type": "audio"
      }
    ],
    [
      {
        "extra": [
          {
            "type": "a_volume",
            "volume": 0.3
          },
          {
            "fade_in": 300,
            "fade_out": 800,
            "type": "a_fade"
          }
        ],
        "source": "https://cdn.example.com/uploads/music.mp3",
        "target_time": [
          0,
          8000
        ],
        "type": "audio"
      }
    ],
    [
      {
        "align_type": 1,
        "extra": [
          {
            "height": 160,
            "pos_x": 90,
            "pos_y": 1560,
            "type": "transform",
            "width": 900
          }
        ],
        "font_size": 64,
        "target_time": [
          0,
          4000
        ],
        "text": "First subtitle line",
        "type": "text"
      }
    ]
  ]
}'
```

### Python 示例

```python
import requests

API_KEY = "sk-your-tenant-api-key"
ENDPOINT = "https://see2ai.com/api/v1/actions/see2ai_media_timeline_edit_v1"

headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {API_KEY}"
}

payload = {
  "aigc_meta": {
    "ContentProducer": "your-app",
    "Label": "1",
    "ProduceID": "cut-1"
  },
  "canvas": {
    "height": 1920,
    "width": 1080
  },
  "tracks": [
    [
      {
        "extra": [
          {
            "end_time": 4000,
            "start_time": 0,
            "type": "trim"
          }
        ],
        "source": "https://cdn.example.com/uploads/shot-1.mp4",
        "target_time": [
          0,
          4000
        ],
        "type": "video"
      },
      {
        "extra": [
          {
            "end_time": 5000,
            "start_time": 1000,
            "type": "trim"
          }
        ],
        "source": "https://cdn.example.com/uploads/shot-2.mp4",
        "target_time": [
          4000,
          8000
        ],
        "type": "video"
      }
    ],
    [
      {
        "source": "https://cdn.example.com/uploads/voice.m4a",
        "target_time": [
          0,
          8000
        ],
        "type": "audio"
      }
    ],
    [
      {
        "extra": [
          {
            "type": "a_volume",
            "volume": 0.3
          },
          {
            "fade_in": 300,
            "fade_out": 800,
            "type": "a_fade"
          }
        ],
        "source": "https://cdn.example.com/uploads/music.mp3",
        "target_time": [
          0,
          8000
        ],
        "type": "audio"
      }
    ],
    [
      {
        "align_type": 1,
        "extra": [
          {
            "height": 160,
            "pos_x": 90,
            "pos_y": 1560,
            "type": "transform",
            "width": 900
          }
        ],
        "font_size": 64,
        "target_time": [
          0,
          4000
        ],
        "text": "First subtitle line",
        "type": "text"
      }
    ]
  ]
}

response = requests.post(ENDPOINT, json=payload, headers=headers)
result = response.json()

print(f"结果：{result}")
```

## 💰 计费说明

> CNY 0.01 per output minute x resolution coefficient (audio-only or up to 360P 1, 480P 1.5, 540P 2, 720P 3, 1080P 6, 2K 12, 4K 24). Charged only on success; the hold covers the timeline length plus one second.

**注意**: 所有费用都以词元为单位，系统会自动从租户余额中扣除。

## ⚠️ 常见错误码

| HTTP 状态码 | 错误原因 | 解决方案 |
| --- | --- | --- |
| `402` | Insufficient balance for the maximum task charge | 请稍后重试 |
| `409` | The idempotency key is bound to a different or in-flight request | 请稍后重试 |
| `422` | Invalid timeline (including a render too large to deliver), or the media service could not accept an input | 检查请求参数是否符合 Schema 要求 |
| `503` | Task submission or settlement is temporarily unavailable | 请稍后重试 |

## 📞 技术支持

- **文档问题**: 查看 [SEE2AI 官方文档](https://see2ai.com/docs)
- **API 状态**: 访问 [服务状态页面](https://see2ai.com/status)
- **问题反馈**: 联系技术支持团队

---

**API 版本**: see2ai_media_timeline_edit_v1
**最后更新**: 2026-03-23
