All Products
Search
Document Center

OpenSearch:Video snapshot

Last Updated:Nov 05, 2025

AI Search Open Platform supports calling the video snapshot service through APIs to extract keyframes from videos. Combined with OCR, image parsing, or multimodal embedding services, it enables deep parsing and structured processing of video content.

Services

Service name

Service ID

Service description

API call QPS limit (including Alibaba Cloud account and RAM users)

Video Snapshot Service 001

ops-video-snapshot-001

Video Snapshot Service 001 (ops-video-snapshot-001) provides video content extraction capabilities to capture keyframes from videos. Combined with multimodal embedding services or image parsing capabilities, it enables cross-modal retrieval.

5

Note

To apply for higher QPS, submit a ticket.

  • The authentication information is obtained.

    When you call an AI Search Open Platform service by using an API, you need to authenticate the caller's identity.

  • The service access address is obtained.

    You can call a service over the Internet or a virtual private cloud (VPC). For more information, see Get service registration address.

Create an asynchronous task

Request method: POST

URL

{host}/v3/openapi/workspaces/{workspace_name}/video-snapshot/{service_id}/async
  • workspace_name: The name of the workspace, such as default.

  • service_id: The built-in service ID, such as ops-video-snapshot-001.

Request parameters

Header parameters

API-KEY authentication

Parameter

Type

Required

Description

Example

Content-Type

String

Yes

Request type: application/json

application/json

Authorization

String

Yes

API-Key

Bearer OS-d1**2a

Body parameters

Parameter

Type

Required

Description

input

Object(input)

Yes

Specifies the multimedia file to be processed.

parameters

Object

No

Specifies the parameters for the service.

output

Object(output)

Yes

Controls the output format and file storage path.

input

Parameter

Type

Required

Description

content

String

No

Base64 encoding data of the video content. Supported formats include mp4, avi, mkv, mov, flv, and webm.

Note

The input.content and input.oss parameters are exclusive. You can specify only one of them.

  • Using BASE64 data: Pass the encoded BASE64 data to the content parameter in the format data:video/<FORMAT>;base64,<BASE64_VIDEO>, where:

    • video/<FORMAT>: The format of the video. For example, if the video is in mp4 format, set this to video/mp4.

    • <BASE64_VIDEO>: The BASE64 data of the image.

  • Example: data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAABAGlzbWZj...

oss

String

No

The OSS path of the input file, for example, oss://<BUCKET_NAME>/xxx/xxx.mp4.

file_name

String

No

The name of the video file. If not set, it is parsed from the file name in the content.

Parameters

Parameter

Type

Required

Description

interval

Int

No

The keyframe interval. Default value: 1. Unit: second.

format

String

No

The supported output formats for frame captures are jpg and png. The default format is jpg.

output

Parameter

Type

Required

Description

type

String

No

base64: Returns the image content in base64 format, supported only in synchronous calls.

oss: Stores snapshot files in OSS (default).

oss

String

No

The OSS path of the output file. This parameter is required when type is set to oss.

Example: oss://<BUCKET_NAME>/result/path

Response parameters

Parameter

Type

Description

Example

result.task_id

String

The unique ID of the video extraction task.

snapshot-xxxx-abc-123

Curl request example

curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <Your API-KEY>" \
  "http://***-hangzhou.opensearch.aliyuncs.com/v3/openapi/workspaces/default/video-snapshot/ops-video-snapshot-001/async"
  --data '{
    "input":{
        "oss" : "oss://<BUCKET_NAME>/test.mp4"
    },
    "parameters" : {
    },
    "output": {
        "type":"oss",
        "oss" :"oss://<BUCKET_NAME>/result/path"
    }
  }' \ 

Response example

{
  "request_id":"de81e152284a2d3b1f4315d*******",
  "latency":21,
  "usage":{},
  "result":{
        "task_id":"snapshot-20250617102142-110841*******-*******",
        "status":"PENDING"
            }
 }

Get the status of an asynchronous task

Request method: GET

URL

{host}/v3/openapi/workspaces/{workspace_name}/video-snapshot/{service_id}/async/task-status?task_id={task_id}
  • host: The endpoint of the service. You can call the API service over the Internet or through a VPC. For more information, see Obtain service access addresses.

  • workspace_name: The name of the workspace, such as default.

  • service_id: The built-in service ID, such as ops-video-snapshot-001.

Request parameters

Parameter

Type

Required

Description

Example

service_id

String

Yes

The service ID.

ops-video-snapshot-001

task_id

String

Yes

The task ID from the response when creating an asynchronous video snapshot task.

snapshot-xxxx-abc-123

Response parameters

Parameter

Type

Description

Example

result.task_id

String

The unique ID of the video extraction task.

snapshot-xxxx-abc-123

result.status

String

Task status:

  • PENDING: Pending

  • SUCCESS: Task completed successfully

  • FAIL: Task failed and terminated

PENDING

result.error

String

Error message content when status=FAIL. Empty under normal conditions.

result.data

List(SnapshotResult)

The result of video processing.

usage.image_count

Int

The number of images output from the snapshot.

SnapshotResult

Parameter

Type

Description

frame_index

Int

The frame number in the video.

path

String

The OSS path of the file. When the user specifies OSS as the output, this is the storage path of the snapshot result in OSS, URL-encoded.

content

String

The Base64-encoded content of the image. Only one of content or path will exist, and content is returned only when executing a synchronous task.

frame_time

Float

The timestamp of the current snapshot frame in the video, in seconds.

Curl request example

curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <Your API-KEY>" \
"http://***-hangzhou.opensearch.aliyuncs.com/v3/openapi/workspaces/default/video-snapshot/ops-video-snapshot-001/async/task-status?task_id=snapshot-20250617102142-1108418170738252-******" \

Response example

{
  "request_id":"83b423e2e63613a878c369c20******",
  "latency":11,
  "usage":{
      "image":64
          },
  "result":{
      "task_id":"snapshot-20250617102142-1108418170738252-******",
      "status":"SUCCESS",
       "data":[
                {
                  "frame_index": 0,
                  "path": "oss://bucket-name/result/path/snapshot-xxxx-abc-123-xxx/snapshot_0.jpg",
                  "frame_time": 0.0
                },
                ......
                {
                  "frame_index": 1890,
                  "path": "oss://bucket-name/result/path/snapshot-xxxx-abc-123-xxx/snapshot_63.jpg",
                  "frame_time": 63.0
                }                
              ]
            }
}

Create a synchronous video snapshot task

URL

{host}/v3/openapi/workspaces/{workspace_name}/video-snapshot/{service_id}/sync
  • workspace_name: The name of the workspace, such as default.

  • service_id: The built-in service ID, such as ops-video-snapshot-001.

Request parameters

Header parameters

API-KEY authentication

Parameter

Type

Required

Description

Example

Content-Type

String

Yes

Request type: application/json

application/json

Authorization

String

Yes

API-Key

Bearer OS-d1**2a

Body parameters

Parameter

Type

Required

Description

input

Object(input)

Yes

Specifies the multimedia file to be processed.

parameters

Object

No

Specifies the parameters for the service.

output

Object(output)

Yes

Controls the output format and file storage path.

input

Parameter

Type

Required

Description

content

String

No

Base64 encoding data of the video content. Supported formats include mp4, avi, mkv, mov, flv, and webm.

Note

The input.content and input.oss parameters are exclusive. You can specify only one of them.

  • Using BASE64 data: Pass the encoded BASE64 data to the content parameter in the format data:video/<FORMAT>;base64,<BASE64_VIDEO>, where:

    • video/<FORMAT>: The format of the video. For example, if the video is in mp4 format, set this to video/mp4.

    • <BASE64_VIDEO>: The BASE64 data of the image.

  • Example: data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAABAGlzbWZj...

oss

String

No

The OSS path of the input file, for example, oss://<BUCKET_NAME>/xxx/xxx.mp4.

file_name

String

No

The name of the video file. If not set, it is parsed from the file name in the content.

Parameters

Parameter

Type

Required

Description

interval

Int

No

The keyframe interval. Default value: 1. Unit: second.

format

String

No

The supported output formats for frame captures are jpg and png. The default format is jpg.

output

Parameter

Type

Required

Description

type

String

No

base64: Returns the image content in base64 format, supported only in synchronous calls.

oss: Stores snapshot files in OSS (default).

oss

String

No

The OSS path of the output file. This parameter is required when type is set to oss.

Example: oss://<BUCKET_NAME>/result/path

Response parameters

Parameter

Type

Description

Example

result.task_id

String

The unique ID of the video extraction task.

snapshot-xxxx-abc-123

Curl request example

curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <Your API-KEY>" \
  "http://***-hangzhou.opensearch.aliyuncs.com/v3/openapi/workspaces/default/video-snapshot/ops-video-snapshot-001/sync"
  --data '{
    "input":{
        "oss" : "oss://<BUCKET_NAME>/test.mp4"
    },
    "parameters" : {
    },
    "output": {
        "type":"oss",
        "oss" :"oss://<BUCKET_NAME>/result/path"
    }
  }' \ 

Response example

{
  "request_id":"83b423e2e63613a878c369c20******",
  "latency":11,
  "usage":{
      "image":64
          },
  "result":{
      "task_id":"snapshot-20250617102142-1108418170738252-b******",
      "status":"SUCCESS",
       "data":[
                {
                  "frame_index": 0,
                  "path": "oss://bucket-name/result/path/snapshot-xxxx-abc-123-xxx/snapshot_0.jpg",
                  "frame_time": 0.0
                },
                ......
                {
                  "frame_index": 1890,
                  "path": "oss://bucket-name/result/path/snapshot-xxxx-abc-123-xxx/snapshot_63.jpg",
                  "frame_time": 63.0
                }                
              ]
            }
}

Status codes

When a request error occurs, the output result will indicate the error cause through code and message.

{
    "request_id": "6F33AFB6-A35C-4DA7-AFD2-9EA16CCF****",
    "latency": 2.0,
    "code": "InvalidParameter",
    "http_code": 400,
    "message": "JSON parse error: Cannot deserialize value of type `ImageStorage` from String \"xxx\"
}

HTTP status code

Error code

Description

200

-

The request is successful, including task failure scenarios. The actual task status needs to be determined from result.status.

404

BadRequest.TaskNotExist

The error message returned because the task does not exist.

400

InvalidParameter

Invalid Request.

500

InternalServerError

Internal error.

For more information about status codes, see Status codes.