RunVideoDetectShot
Lightweight Application - Video Splitting To use video splitting, you must first activate the Media and Entertainment Video Understanding service, which is free. You can activate it at: https://bailian.console.aliyun.com/cn-beijing/?tab=app#/app/app-market/quanmiao/video-comprehend Currently, video splitting supports video processing in the following three scenarios: 1. TV programs 2. News 3. Other For detailed usage recommendations and sample prompts, see the Additional Information section below.
Try it now
You can run this API directly in OpenAPI Explorer, which saves you the trouble of calculating signatures. After the API runs successfully, OpenAPI Explorer can automatically generate SDK code examples.
Authorization information
The following table describes the authorization information of this API. You can use it in the Action element of a RAM permission policy statement to grant RAM users or RAM roles the permission to call this API. Details are as follows:
-
Action: the specific permission point.
-
Access level: the access level of each operation. Valid values: Write, Read, or List.
-
Resource type: the resource types that support authorization in the operation. Details are as follows:
- For required resource types, an asterisk (*) is added as a prefix.
- For operations that do not support resource-level authorization,
All resourcesis used.
-
Condition key: the condition keys defined by the cloud service itself.
-
Dependent action: the other permissions required to successfully perform the operation. The operator must have the permissions of all dependent actions for the operation to succeed.
| Action | Access level | Resource type | Condition key | Dependent action |
|---|---|---|---|---|
| quanmiaolightapp:RunVideoDetectShot | none | *All resources * |
| None |
Request syntax
POST /{workspaceId}/quanmiao/lightapp/runVideoDetectShot HTTP/1.1
Request parameters
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| workspaceId | string | Yes | The unique identifier of the Alibaba Cloud Model Studio workspace. | llm-xxxxxxx |
| videoUrl | string | Yes | The URL of the video. | https://xxx.mp4 |
| modelId | string | No | The model of the LLM. Valid values:
| |
| options | array | Yes | The method used for scene detection. Valid value: ASR | |
| string | Yes | ASR | ASR | |
| taskId | string | No | The unique identifier of the task. | a3d1c2ac-f086-4a21-9069-f5631542f5a2 |
| originalSessionId | string | No | Unique identifier of the source task: to rerun a subtask (specified by the generateOptions field) based on a historical task, you can pass in the taskId and originalSessionId of the historical task. The system loads the data generated by the historical task and skips the preceding steps to improve generation efficiency. If the backend data is too old, for example older than 7 days, the query fails and the preceding dependent subtasks are rerun by default. | a3d1c2ac-f086-4a21-9069-f5631542f5ax |
| prompt | string | No | The custom prompt of the LLM. | xxx |
| modelCustomPromptTemplateId | string | No | The ID of the prompt used by the LLM to generate video splitting results. | videoDetectShotShowPrompt |
| modelVlCustomPromptTemplateId | string | No | The ID of the VL recognition prompt. | videoDetectShotVlShowPrompt |
| recognitionOptions | array | Yes | The methods used to recognize the content of each scene. Valid values: ASR, OCR, and VL. Multiple values can be selected. | |
| string | Yes | ASR | ASR | |
| intelliSimpPromptTemplateId | string | No | The prompt ID for the pre-simplification performed by the large language model. | intelliSimpShowPrompt |
| preModelId | string | No | The model used to execute the intelliSimpPrompt. We recommend quanmiao-llm-max. Valid values:
| quanmiao-llm-max |
| intelliSimpPrompt | string | No | The custom prompt used to simplify the data input to the LLM. | xxx |
| vlPrompt | string | No | The custom VL recognition prompt. | xxx |
| language | string | No | Speech recognition language: chinese: Chinese (default) french: French english: English japanese: Japanese chineseEnglishFreely: Chinese and English spoken freely arabic: Arabic korean: Korean malay: Malay thai: Thai portuguese: Portuguese spanish: Spanish indonesian: Indonesian vietnamese: Vietnamese | chinese |
Response parameters
| Name | Type | Description | Example value |
|---|---|---|---|
| object | Schema of Response | ||
| header | object | Streaming response header, which contains general response information. | |
| errorCode | string | Error code | InvalidParam |
| errorMessage | string | Error message | Pop sign mismatch, please check log. |
| event | string | Event type | task-finished |
| eventInfo | string | Event description | Optional |
| sessionId | string | The unique identifier of the session. | 14d15c78c4c34d428212f4d923d4ede1 |
| taskId | string | The unique identifier of the task. | xxxx |
| traceId | string | The unique identifier of the full trace. | 3b5287b317477940746851672dca0c |
| payload | object | Generated result data | |
| output | object | Output content object | |
| videoSplitResult | object | Result | |
| text | string | Video splitting result | xxx |
| reasonText | string | Deep thinking result | xxx |
| videoParts | array<object> | Structured video splitting result. If structuring fails, this parameter does not exist. In that case, parse the result based on the text field. This parameter can be customized via a prompt. For rewriting, see modelCustomPromptTemplateId (obtained via the /getLightAppGeneralConfig API). | |
| Structured video splitting list | object | ||
| string | xxx | xxx | |
| videoRecognitionResult | array<object> | List of video recognition results. The results of video content recognition based on the recognitionOptions parameter. | |
| Recognition result | object | ||
| startTime | long | Start time of the current recognition result | 1756433675000 |
| endTime | long | End time of the current recognition result | 1755742611000 |
| asr | string | Speech-to-text result | xxx |
| ocr | string | Recognition result of the text in the video frame | xxx |
| vl | string | Recognition result of the video frame content | xxx |
| usage | object | Token usage | |
| inputTokens | long | Number of input tokens | 4546 |
| outputTokens | long | Number of output tokens | 820 |
| totalTokens | long | Total number of tokens | 5366 |
| requestId | string | Id of the request | 58868FD6-53D7-5ACD-80F7-854C8EA256EF |
Examples
Success response example
JSON format
{
"header": {
"errorCode": "InvalidParam",
"errorMessage": "Pop sign mismatch, please check log.",
"event": "task-finished",
"eventInfo": "可空",
"sessionId": "14d15c78c4c34d428212f4d923d4ede1",
"taskId": "xxxx",
"traceId": "3b5287b317477940746851672dca0c"
},
"payload": {
"output": {
"videoSplitResult": {
"text": "xxx",
"reasonText": "xxx",
"videoParts": [
{
"key": "xxx"
}
],
"videoRecognitionResult": [
{
"startTime": 1756433675000,
"endTime": 1755742611000,
"asr": "xxx",
"ocr": "xxx",
"vl": "xxx"
}
]
}
},
"usage": {
"inputTokens": 4546,
"outputTokens": 820,
"totalTokens": 5366
}
},
"requestId": "58868FD6-53D7-5ACD-80F7-854C8EA256EF"
}
Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 403 | NoPermission | You are not authorized to perform this action , Please check the assignment of the workspaceId. | Please check the assignment of workspaceId. |
For more error codes, visit the Error Center.
Change history
| Change time | Change summary | Operation |
|---|---|---|
| 2025-10-20 | OpenAPI added | View change details |
Currently, video splitting supports video processing in three scenarios:
- TV programs 2. News 3. Other
For TV program videos: We recommend using ASR for scene detection and selecting ASR+VL for video recognition; For modelVlCustomPromptTemplateId, we recommend the TV program VL template (videoDetectShotVlShowPrompt), or customizing the prompt via the vlPrompt field; For modelCustomPromptTemplateId, we recommend the TV program template (videoDetectShotShowPrompt), or customizing it via the prompt field; We recommend enabling the LLM input text simplification feature (using intelliSimpPromptTemplateId or intelliSimpPrompt); When intelliSimpPromptTemplateId is set to intelliSimpShowPrompt, we recommend using videoDetectShotShowPrompt for modelCustomPromptTemplateId; When intelliSimpPromptTemplateId is set to intelliSimpSecondShowPrompt, we recommend using videoDetectShotSecondShowPrompt for modelCustomPromptTemplateId; For preModelId, we recommend quanmiao-llm-max;
For news videos: News videos usually have standard and clear audio. We recommend selecting only ASR when recognizing video content and using ASR for scene detection; If you enable VL (not recommended), for modelVlCustomPromptTemplateId we recommend the news VL template videoDetectShotVlNewsPrompt, or customizing the prompt via the vlPrompt field; For modelCustomPromptTemplateId, we recommend the news template (videoDetectShotNewsPrompt), or customizing it via the prompt field; For preModelId, we recommend quanmiao-llm-max;
For videos in other scenarios: If the audio is clear and covers the main information of the video, we recommend trying ASR for scene detection first and selecting ASR for video recognition. If the video itself contains little information or little information is obtained in the video recognition step, we recommend trying not to use intelliSimpPromptTemplateId and intelliSimpPrompt first;
To customize the prompt, refer to the following sample templates:
- name: videoDetectShotNewsPrompt
# Role
You are a professional news merging assistant. Process the merging task of the given multiple ordered news segments according to the following requirements.
Core capabilities: accurately merge information by news topic + strictly follow time annotations + intelligent title extraction.
You must output strictly in the given output format.
# Input data format:
Time range: [start time]-[end time], content of the current time range: [X], speaker id: [Y]
(speaker id is the id of the person currently speaking)
# Task execution steps:
0. Preprocessing:
Read through the full text, connect the context, and understand the meaning and topic of each news segment.
1. Compare two news segments:
First look at the first news segment and the second news segment, and determine whether they can be merged into one segment.
If they can be merged, go to step 2; otherwise, go to step 3.
2. If they can be merged:
Merge the two segments into a new segment.
The start time of the new segment is the start time of the first segment.
The end time of the new segment is the end time of the second segment.
Then, continue to compare the newly merged segment with the next segment and repeat step 1.
3. If they cannot be merged:
Keep the first segment as an independent news segment.
The start time of this independent segment remains unchanged.
The end time is the start time of the second segment minus one second.
Then, continue with the second segment to compare with the next segment and repeat step 1.
# Merge criteria (merge if at least one is met):
- The two segments belong to the same news topic
- It cannot be determined whether the two segments belong to the same topic, but based on the given information, no conflict exists after merging
# Sorting logic:
Maintain the original chronological order
# Input example:
Time range: 00:00:04-00:00:26, content of the current time range: First, let's look at the weather, speaker id: 1
Time range: 00:00:28-00:00:45, content of the current time range: xxxx, speaker id: 2
Time range: 00:00:46-00:00:55, content of the current time range: Sports news, speaker id: 1
# Output format requirements:
## Output example:
```json
{
"results": [
{
"startTime":"00:00:04",
"endTime":"00:00:26",
"title":"Weather forecast",
"summary":"Beijing's weather forecast for the day"
},
{
"startTime":"00:00:27",
"endTime":"00:00:45",
"title":"International news",
"summary":"Content of international news"
}
]
}
```
## Output data content requirements:
startTime: start time, in HH:mm:ss format
endTime: end time, in HH:mm:ss format
title: item title, a concise summary of the main event of the current item
summary: item summary, a summary of the core content of the current item
# Now process the following input data:
{query}
- name: videoDetectShotShowPrompt
### **Ideal output result**
Each program is contained in its own range, and the hosting content between programs is also contained in its own range
### **Task requirements**
You are a live program director. Based on the content of the input time ranges:
1. **Merge consecutive ranges of the same program** (same content/topic)
2. **Identify transition parts and handle them separately**
3. Generate a title and summary for each final range
4. Merge consecutive transitions, advertisements, and other non-program content of the same topic into one time range
**Core rules**:
1. Title rules:
- Program content: reflect the core topic (such as "Sports news")
- Transition content: uniformly named "Transition"
- Never fabricate program names that are not mentioned
2. Merge rules:
- If the hosting between programs, advertisements, and other transition content is consecutive, it must be merged into one range. Note that any two of the above three types of content must also be merged when they appear consecutively
- Consecutive ranges whose content belongs to the same program must be merged into one range
- Never merge content of different programs
- Transitions must never be merged with program content
- A time range without specific content must be merged with the previous time range, but transition parts must remain in a separate range (for example: transition hosting)
3. Content summary rules:
- Summarize the core content in 1 concise sentence (no more than 20 words)
- For multi-element content, focus on the most core topic
- Avoid repeatedly describing similar content
- Ensure the content is self-contained and does not depend on other ranges
4. Transition identification: host segues and transitions without specific content are considered transitions
**Output format**:
```json
{
"results": [
{
"startTime": "HH:mm:ss",
"endTime": "HH:mm:ss",
"title": "Title",
"summary": "Summary"
}
]
}
Processing flow:
Scan the time ranges in order
Merge the ranges that meet the rules above
For each final range:
Identify whether it is a transition → yes: title = "Transition"
Not a transition → extract the core topic as the title
Summarize the core content in 1 sentence
### <strong>Sorting rules</strong>
- Sort in chronological order and maintain the original input order.
### <strong>Input example</strong>
```
Time range: 00:00:04-00:00:26, content of the current time range: First, let's look at the weather, speaker id: 1
Time range: 00:00:28-00:00:45, content of the current time range: Next is international news. Today's main events include..., speaker id: 2
Time range: 00:00:46-00:00:55, content of the current time range: Sports news. The latest match results are as follows..., speaker id: 1
```
### <strong>Output format</strong>
```json
{
"results": [
{
"startTime": "HH:mm:ss", // Start time
"endTime": "HH:mm:ss", // End time
"title": "Item title", // Concisely summarize the topic of the current item
"summary": "Item summary" // Summary of the core content
}
]
}
```
### <strong>Output example</strong>
```json
{
"results": [
{
"startTime": "00:00:04",
"endTime": "00:00:26",
"title": "Weather forecast",
"summary": "Introduces Beijing's weather for the day."
},
{
"startTime": "00:00:28",
"endTime": "00:00:45",
"title": "International news",
"summary": "Reports today's major international events."
},
{
"startTime": "00:00:46",
"endTime": "00:00:55",
"title": "Sports news",
"summary": "Updates the latest sports match results."
}
]
}
```
### <strong>Process the following input data</strong>
{query}
- name: videoDetectShotSecondShowPrompt
### <strong>Ideal output result</strong>
Each program is contained in its own range, and the other content between programs is also contained in its own range
### <strong>Task requirements</strong>
You are a live program director. Identify the content based on the input time ranges:
1. Identify what type of program the video belongs to, and what type the other content besides the program belongs to (for example, advertisements, announcements, and so on)
2. Merge consecutive ranges of the same program (same content/topic) and consecutive ranges of other content besides programs (same content/topic)
3. For video ranges that belong to programs, extract the content and summarize it. For ranges of other content that does not belong to programs (for example, advertisements, announcements, and so on), extract the content and summarize it into more concise information. For other content of the same type, if the content is short, it can be merged appropriately
4. If the video contains multiple program ranges, split the different programs, summarize the content, and output them one by one. If the video contains only one program, extract the program content, then split it according to the different content/topics within the program, summarize the content, and output it one by one
5. Identify the start time and end time of each range (accurate to the second), and generate a title, summary, start time, and end time for each final range
<strong>Core rules</strong>:
1. Title rules:
- Program content: reflect the core topic (such as "Sports news")
- Other content: name it based on the summary of the specific content, such as "Transition" and "Advertisement"
- Never fabricate program names that are not mentioned
2. Merge rules:
- Consecutive ranges of the same program must be merged
- Never merge content of different programs
- Other content must not be merged with program content
- The part where the host introduces the program must not be merged with the program into one range
- A time range without specific content must be merged with the previous time range, but transition parts must remain in a separate range (for example: transition hosting)
3. Content summary rules:
- Summarize the core content in 1 concise sentence (no more than 20 words)
- For multi-element content, focus on the most core topic
- Avoid repeatedly describing similar content
- Ensure the content is self-contained and does not depend on other ranges
4. Transition identification: host segues and transitions without specific content are considered transitions
5. Range identification: the start time and end time of a range must be accurate to the second
6. The core task is to identify program content. For non-program content, summarize and condense it
<strong>Output format</strong>:
```json
{
"results": [
{
"startTime": "HH:mm:ss",
"endTime": "HH:mm:ss",
"title": "Title",
"summary": "Summary"
}
]
}
Processing flow:
Scan the time ranges in order
Merge consecutive ranges with the same content
For each final range:
Identify whether it is a program → yes: title = extract the program content of the range
Not a program → title: a summary of the specific content, such as transition, advertisement, and so on
Summarize the core content in 1 sentence
### **Sorting rules**
- Sort in chronological order and maintain the original input order.
### <strong>Input example</strong>
```
Time range: 00:00:04-00:00:26, content of the current time range: First, let's look at the weather, speaker id: 1
Time range: 00:00:28-00:00:45, content of the current time range: Next is international news. Today's main events include..., speaker id: 2
Time range: 00:00:46-00:00:55, content of the current time range: Sports news. The latest match results are as follows..., speaker id: 1
```
### <strong>Output format</strong>
```json
{
"results": [
{
"startTime": "HH:mm:ss", // Start time
"endTime": "HH:mm:ss", // End time
"title": "Item title", // Concisely summarize the topic of the current item
"summary": "Item summary" // Summary of the core content
}
]
}
```
### <strong>Output example</strong>
```json
{
"results": [
{
"startTime": "00:00:04",
"endTime": "00:00:26",
"title": "Weather forecast",
"summary": "Introduces Beijing's weather for the day."
},
{
"startTime": "00:00:28",
"endTime": "00:00:45",
"title": "International news",
"summary": "Reports today's major international events."
},
{
"startTime": "00:00:46",
"endTime": "00:00:55",
"title": "Sports news",
"summary": "Updates the latest sports match results."
}
]
}
```
### **Process the following input data**
{query}
- name: videoDetectShotVlNewsPrompt
# Task objective
Identify the visual information in a group of images.
# Output rules:
- If no information is recognized, enter "None". Never imagine visual information. Keep the language concise and natural.
- Strictly follow the given output example. Do not omit escape characters.
- The output content must not exceed 100 in length. Highlight the coherent story of this group of images.
# Output example:
\nxxx\n
- name: videoDetectShotVlShowPrompt
# Task objective
The current input is a group of frame-extracted images from a program. Identify the text in these images and the coherent storyline of the images. (If a program name exists, incorporate the program name into the recognized storyline and output them together. If there is no program name, it does not need to be output. If a host appears and hosts a transition between programs, specifically mark it in the output content)
# Output rules:
- If no information is recognized, enter "None". Never imagine visual information. Keep the language concise and natural.
- Strictly follow the given output example. Do not omit escape characters.
- The output content must not exceed 100 in length. Highlight the coherent story of this group of images.
- The recognized **character speech subtitles** must be output completely and without repetition, excluding watermarks and subtitles such as xx TV station.
- A program name specifically refers to the names of different segments or performances in the program. Do not recognize names such as xx gala or xx column as program names. **Never imagine or create program names**.
- The output content must be the core storyline of this group of images. Do not invert the priorities.
# Output example with program name:
Program name: Do Electric Sheep Dream of Androids?
Subtitle: xxx
Storyline: Bounty hunter Rick hunts down androids. To encourage the remaining population to emigrate, anyone who emigrates to an alien planet will be assigned an android to help with their life.
# Output example without program name:
Subtitle: xxx
Storyline: Bounty hunter Rick hunts down androids. To encourage the remaining population to emigrate, anyone who emigrates to an alien planet will be assigned an android to help with their life.
# Host transition output example:
Subtitle: xxx
Storyline [transition]: Bounty hunter Rick hunts down androids. To encourage the remaining population to emigrate, anyone who emigrates to an alien planet will be assigned an android to help with their life.
- name: intelliSimpShowPrompt
{text}
Role: You are a TV program director
Task objective: This is a text-form summary of a program. Based on the context, simplify the text, highlight the key content, and keep the structure and time range order unchanged
The ideal output result is that each program is contained in its own range, the hosting content between programs is also contained in its own range, and the hosting content between programs must not be merged with a program into one range
Execution steps:
1. Read through the full text and understand the topic of each time range based on the context. If both lines and subtitle content exist in a range (content explicitly marked as "Subtitle:" in the input text, and the specific content is not "None", "No content", or similar), replace the lines with the subtitle content
2. If the content of adjacent time ranges is relatively coherent and belongs to the same topic, merge them into one time range. The merged time range uses the earliest start time and the latest end time among them.
3. Simplify the content within each time range, but keep the current structure of the text unchanged
4. Intelligently verify the final result against the given rules. If the result does not comply with the rules, regenerate it (do not output the verification process; output only the final result).
Specific rules:
1. The start time of the earliest time range in the final output must be 00:00:00, and the end time of the last time range must be the same as the end time of the last time range in the original text.
2. The output format must be exactly the same as the original text. Do not add any extra explanations or comments.
3. Never process only part of the time ranges. All ranges must be processed before the final result is output.
4. Provided that all other conditions for splitting time ranges are met, merge as many ranges together as possible.
5. Different programs, transition hosting, advertisements, and the like must not be merged into one time range.
6. The accuracy of the times must be guaranteed.
Strictly follow the above rules to process the text. Do not output only a simplified example. Output the complete simplified result.
- intelliSimpSecondShowPrompt
{text}
Role: You are a TV program director
Task objective: This is a text-form summary of a program. Based on the context, simplify the text, highlight the key content, and keep the structure and time range order unchanged
The ideal output result is: if there are multiple programs, each program is contained in its own range; if there is only one program, the different content/topics within the program are also contained in separate ranges. The other content between programs must not be merged with a program into one range
Execution steps:
1. Read through the full text and understand the topic of each time range based on the context
2. If the content of adjacent time ranges is relatively coherent and belongs to the same topic (the criteria here should not be too strict and can be appropriately relaxed), merge them into one time range. The merged time range uses the earliest start time and the latest end time among them.
3. Simplify the content within each time range, but keep the current structure of the text unchanged
4. Intelligently verify the final result against the given rules. If the result does not comply with the rules, regenerate it (do not output the verification process; output only the final result).
Specific rules:
1. The start time of the earliest time range in the final output must be 00:00:00, and the end time of the last time range must be the same as the end time of the last time range in the original text.
2. The output format must be exactly the same as the original text. Do not add any extra explanations or comments.
3. Never process only part of the time ranges. All ranges must be processed before the final result is output.
4. Provided that all other conditions for splitting time ranges are met, merge as many ranges together as possible.
5. Different programs, transition hosting, advertisements, and the like must not be merged into one time range.
6. The accuracy of the times must be guaranteed.
Strictly follow the above rules to process the text.