Video Segment

Detect shot boundaries from visual changes in a video and return structured segment ranges. By default the API returns only structured results. Set only_struct to false if you also want exported clip files.

Create Task

Basic Information

ItemValue
Request MethodPOST
Request Path/task/video_segment
Content-Typeapplication/json
AuthenticationRaw API key in the Authorization header

Request Body

ParameterTypeRequiredDefaultDescription
file_idstringYes-Uploaded video file ID
detectorstringNo"content"Segment detector type. Supports content and adaptive
thresholdnumberNocontent: 45 / adaptive: 7.0Detection threshold. Lower values are more sensitive. If omitted, the default follows the selected detector
asiintegerNo15Minimum segment length in frames
start_timenumberNo-Optional analysis start position. Integers are interpreted as frame numbers, while floats are interpreted as seconds
end_timenumberNo-Optional analysis end position. Integers are interpreted as frame numbers, while floats are interpreted as seconds. Must be greater than start_time
only_structbooleanNotrueWhether to return only structured segment data without exporting files
need_audiobooleanNotrueWhether exported clips should keep audio. Applies only when only_struct=false

Detector Default Thresholds

detectorDefault thresholdDescription
content45Recommended for regular cut detection based on visual content changes
adaptive7.0Recommended for more sensitive cut detection with adaptive thresholds

If threshold is not provided, the API automatically uses the default value for the selected detector.

Request Example

curl -X POST https://api.ai-mcn.tv:10000/task/video_segment \
  -H "Authorization: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "file_id": "537489015178246",
    "detector": "content",
    "threshold": 45,
    "asi": 15,
    "only_struct": true
  }'

Success Example

{
  "code": 200,
  "msg": "success",
  "data": {
    "task_id": "537489015178247",
    "task_type": "video_segment",
    "status": "queued"
  }
}

Query Task Result

Basic Information

ItemValue
Request MethodGET
Request Path/task/video_segment/{task_id}
AuthenticationRaw API key in the Authorization header

Output Result (output_result)

ParameterTypeDescription
scene_countintegerNumber of detected segments
scene_listarray<object>Segment ranges. Each item includes id, start_time, end_time, and duration
filesarray<object>Exported clip files, returned only when only_struct=false. Each item includes id, file_id, and download_url, and id maps to scene_list[].id

Success Example

{
  "code": 200,
  "msg": "success",
  "data": {
    "task_id": "537489015178247",
    "status": "completed",
    "progress": 100,
    "output_result": {
      "scene_count": 2,
      "scene_list": [
        {
          "id": 1,
          "start_time": 0.0,
          "end_time": 6.24,
          "duration": 6.24
        },
        {
          "id": 2,
          "start_time": 6.24,
          "end_time": 12.88,
          "duration": 6.64
        }
      ]
    },
    "create_time": "2026-04-09T08:00:00Z",
    "update_time": "2026-04-09T08:01:05Z"
  }
}

Error Codes

Error CodeHTTP StatusDescriptionResolution
6013400Missing file_idAdd the required field
6014400File type does not matchPass a video file ID
6016400Invalid detector, threshold, asi, or time range parametersAdjust the request parameters
6004404File not foundVerify the file_id
6502401Authentication failedCheck the Authorization header

Usage Limits

  • This API currently accepts a single video file per task.
  • start_time and end_time use frame positions when integers are passed, and second offsets when floats are passed.
  • If detector=content and threshold is omitted, the default is 45; if detector=adaptive and threshold is omitted, the default is 7.0.
  • When end_time is passed, it must be greater than start_time.
  • Structured output is returned by default. Set only_struct=false if you also need clip files.