Intelligent highlight editing

Updated at:
Copy as MD

This topic describes the AI-powered highlight editing solution and its API. This solution supports automatic highlight clip extraction and editing from full episodes or multiple source videos for scenarios such as gaming, education, short drama, and live streaming. It helps you produce promotional materials at scale and at low cost.

Background

With the rapid growth of content industries such as gaming, education, short drama, and live streaming, the production efficiency of promotional materials has become a core bottleneck in content delivery. Traditional manual highlight editing relies on heavy repetitive labor and cannot meet the demands of multiple languages, versions, and platforms.

The highlight editing capability is built on a large model that jointly understands plot, shots, and audio. It provides an end-to-end automated video production solution that supports two modes: continuous mode (CONTINUOUS) and mixed cut mode (STORY_CUT). You only need to provide source videos and content preferences. The server automatically completes candidate recall, timeline planning, boundary verification, and video rendering to produce final videos ready for distribution.

Limits

  • A single input video can be up to 3,600 seconds in length. The total input duration for a single task can be up to 14,400 seconds.

  • Input videos must contain both decodable video and audio streams. Silent videos fail with MEDIA_INVALID.

  • Time fields use seconds. Both index and media_index start from 0.

  • The mixed cut mode does not support reverse narration, free segment reordering, or character library capabilities in this release.

Features

Highlight editing tasks are asynchronous tasks under the operator service path /api/v1/operators/highlight-editing. After a task is submitted, a task ID is returned. You must poll the task status through the query API and retrieve the final video results. Both modes use the large model for planning, and the server validates the timeline before exporting with FFmpeg.

Continuous mode (CONTINUOUS)

Continuous mode starts from the opening hook and progresses along the original plot, skipping only the segments marked by the model that pass shot boundary verification. The original narrative order is preserved. This mode is suitable for compressing a full episode into a more compact continuous version.

When using continuous mode, per_media_target_duration must be null and require_all_media must be false.

Mixed cut mode (STORY_CUT)

Mixed cut mode selects and combines segments across multiple source videos. media_index remains non-decreasing, and time within the same source video remains non-decreasing. This mode is suitable for reorganizing multiple episodes into a high-density highlight collection.

Mixed cut mode supports controlling the soft target contribution duration of each video through per_media_target_duration, and can require each output video to cover all inputs through require_all_media.

Usage

Submit a highlight editing task

  • Request method: POST

  • Request path: /api/v1/operators/highlight-editing/tasks

  • Generates a CONTINUOUS or STORY_CUT video. Both modes use the large model for planning, and the server validates the timeline and exports with FFmpeg.

Request parameters

Parameter

Type

Required

Default value

Description

media_inputs

array

Yes

-

Input video list. 1 to 20 videos. The array order represents the plot order.

media_inputs[i].uri

string

Yes

-

Input video URL. HTTP, HTTPS, or OSS URI is supported.

highlight_description

string

No

General short drama highlight criteria

Overall content selection requirements. Maximum 2,000 characters.

editing.mode

string

Yes

-

Output mode. Valid values: CONTINUOUS and STORY_CUT.

editing.output_count

integer

No

3

Maximum number of output videos. Valid values: 1 to 10.

editing.target_duration

number

No

120

Soft target total duration of each output video, in seconds.

editing.per_media_target_duration

number/null

No

null

Soft target contribution duration of each video. Only for STORY_CUT.

editing.require_all_media

boolean

No

false

Whether each output must cover all inputs. Only for STORY_CUT.

editing.opening_hook.description

string/null

No

null

Opening hook preference. Maximum 2,000 characters.

editing.opening_hook.target_duration

number

No

10

Target duration of the hook. Must be less than the output target duration.

output.need_export

boolean

No

true

Whether to render and upload the complete output video.

output.oss

object

No

Platform temporary OSS

Customer OSS output configuration. Must not be provided when need_export=false.

output.oss.region

string

Required when using OSS

-

Customer OSS region ID, such as cn-shanghai.

output.oss.bucket

string

Required when using OSS

-

Customer OSS bucket.

output.oss.object_key

string

Required when using OSS

-

Must contain only {task_id} and {index}. Must be a relative path without . or ...

Request example

{
  "media_inputs": [
    {"uri": "https://media.example.com/episode-01.mp4"},
    {"uri": "https://media.example.com/episode-02.mp4"}
  ],
  "highlight_description": "Prioritize scenes with strong visual impact and character tension",
  "editing": {
    "mode": "STORY_CUT",
    "output_count": 2,
    "target_duration": 120,
    "per_media_target_duration": 60,
    "require_all_media": false,
    "opening_hook": {
      "description": "Prioritize moments of escalating action",
      "target_duration": 10
    }
  },
  "output": {
    "need_export": true,
    "oss": {
      "region": "cn-shanghai",
      "bucket": "customer-bucket",
      "object_key": "highlight-edits/{task_id}/output_{index}.mp4"
    }
  }
}

Response example

{
  "status": "SUCCESS",
  "message": null,
  "data": {"task_id": "1720000000000_efgh", "task_status": "PENDING"}
}

status: API call status. Default: SUCCESS. message: error message, null on success. data.task_id: task ID. data.task_status: async task status, default PENDING.

cURL example

curl -X POST 'http://{endpoint}/api/v1/operators/highlight-editing/tasks' \
  -H 'Content-Type: application/json' \
  -d '{
    "media_inputs": [{"uri": "https://media.example.com/episode-01.mp4"}],
    "editing": {
      "mode": "CONTINUOUS",
      "output_count": 1,
      "target_duration": 120,
      "opening_hook": {"target_duration": 10}
    },
    "output": {"need_export": false}
  }'

HTTP status codes

Code

Description

200

Task submitted successfully.

400

Mode and parameter combination error. status=INVALID_ARGUMENT.

422

Missing field or type/range error. status=INVALID_PARAMS.

500

Internal server error.

Query a highlight editing task

  • Request method: GET

  • Request path: /api/v1/operators/highlight-editing/tasks/{task_id}

  • Queries the status, opening hook, source timeline, and output video URLs. For failed tasks, HTTP still returns 200 with the error in data.error.

Request parameters

Parameter

Type

Required

Default

Description

task_id

string

Yes

-

Task ID from the submit API, in the path.

Response parameters

Field

Type

Always returned

Default

Description

data.task_id

string

Yes

-

Task ID.

data.task_status

string

Yes

-

Task status: PENDING, RUNNING, SUCCESS, or FAILED.

data.mode

string/null

No

-

Output mode: CONTINUOUS or STORY_CUT.

data.outputs

array/null

No

null

Output video list.

outputs[i].index

integer

Yes

-

Output sequence number, from 0.

outputs[i].duration

number

Yes

-

Playback duration in seconds.

outputs[i].opening_hook

object

Yes

-

First opening hook source and time range.

outputs[i].media_results

array

Yes

-

Source segments in playback order.

media_results[j].media_index

integer

Yes

-

Source video index.

media_results[j].start_time

number

Yes

-

Start time in seconds.

media_results[j].end_time

number

Yes

-

End time in seconds.

media_results[j].playback_speed

number

Yes

1.0

Playback speed, 0.8 to 1.2.

outputs[i].output_url

string/null

Yes

null

Platform OSS: temporary signed URL. Customer OSS: persistent HTTPS URL. null when not exported.

data.error

object/null

No

null

Error code and sanitized message on failure.

cURL example

curl 'http://{endpoint}/api/v1/operators/highlight-editing/tasks/1720000000000_efgh'

HTTP status codes

Code

Description

200

Query succeeded, including FAILED tasks.

404

Task not found or not a highlight editing task.

500

Internal server error.

General constraints and error codes

  • Single input video: up to 3,600s. Single task total: up to 14,400s.

  • Input must have video and audio streams. Silent videos fail with MEDIA_INVALID.

  • The server validates time boundaries based on shot, VAD, and ASR results.

  • When need_export=true, FFmpeg rendering and OSS upload are performed. Platform URLs are valid for 7,200s by default.

  • Default output key: highlight-outputs/{task_id}/output_{index}.mp4.

On failure, data.error.code returns: MEDIA_UNAVAILABLE, MEDIA_INVALID, MEDIA_LIMIT_EXCEEDED, ASR_FAILED, MODEL_FAILED, MODEL_OUTPUT_INVALID, PLAN_INVALID, RENDER_FAILED, UPLOAD_FAILED, or INTERNAL_ERROR.

Failed task query example

{
  "status": "SUCCESS",
  "message": null,
  "data": {
    "task_id": "1720000000000_efgh",
    "task_status": "FAILED",
    "error": {
      "code": "MODEL_FAILED",
      "message": "Media analysis or model recall failed."
    }
  }
}

Use case: Short drama overseas distribution

Short drama overseas platforms need to produce promotional materials at scale with strong opening hooks. The highlight editing capability automates this process:

  1. Submit: Place episodes in media_inputs by plot order, select STORY_CUT, and specify opening_hook preferences.

  2. Model planning: The server performs joint understanding of shots, audio, and plot, recalls highlights across episodes, and plans the timeline.

  3. Rendering: The server validates the timeline, renders with FFmpeg, and uploads to customer OSS.

  4. Retrieve: Poll until task_status=SUCCESS, then get the URL from outputs[i].output_url.