POST
/
video
/
extract-frames
Extract Video Frames
curl --request POST \
  --url https://mavi-backend.memories.ai/serve/api/v2/video/extract-frames \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "asset_id": "re_657739295220518912"
}
'
{
  "code": "0000",
  "msg": "success",
  "data": {
    "task_id": "1e8ae1075e054e8abb58e7598c53cbf1"
  },
  "failed": false,
  "success": true
}
This endpoint extracts frames from a video file at specified intervals or timestamps.

Code Examples

const response = await fetch('/video/extract-frames', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'sk-8483027fe3abfe535f6ae01a9979b4f7'
  },
  body: JSON.stringify({
    asset_id: 're_657739295220518912'
  })
});

const data = await response.json();
console.log(data);

Request Body

FieldTypeRequiredDescription
asset_idstringYesThe video asset ID to extract frames from

Response

Returns task information for the frame extraction operation.
{
  "code": "0000",
  "msg": "success",
  "data": {
    "task_id": "1e8ae1075e054e8abb58e7598c53cbf1"
  },
  "failed": false,
  "success": true
}

Response Parameters

ParameterTypeDescription
codestringResponse code indicating the result status
msgstringResponse message describing the operation result
dataobjectResponse data object containing task information
data.task_idstringUnique identifier of the frame extraction task
successbooleanIndicates whether the operation was successful
failedbooleanIndicates whether the operation failed

Callback Response Parameters

When the frame extraction is complete, a callback will be sent to your configured webhook URL.
ParameterTypeDescription
codestringResponse code (“0000” indicates success)
messagestringStatus message (e.g., “SUCCESS”)
dataobjectResponse data object containing the extracted frame information
data.asset_ch_idsarrayArray of asset IDs for each extracted frame
data.asset_idstringThe parent asset ID (image collection) containing all extracted frames
task_idstringThe task ID associated with this frame extraction request

Understanding the Callback Response

The callback response contains an array of frame asset IDs and a parent asset ID that represents the collection of all extracted frames. Response Structure:
callback_response
├── code: "0000"
├── message: "SUCCESS"
├── data
│   ├── asset_ch_ids: [array of frame asset IDs]
│   │   └── [
│   │       "imc_666914042514116608_0",
│   │       "imc_666914042514116608_1",
│   │       "imc_666914042514116608_2",
│   │       ...
│   │     ]
│   └── asset_id: "im_666914042514116608"
└── task_id: "90b7eaf351824f3ba88229eaf2bf7c3d"
How to access the data:
  • All extracted frame IDs: callback_response.data.asset_ch_ids
  • Number of frames extracted: callback_response.data.asset_ch_ids.length
  • First frame ID: callback_response.data.asset_ch_ids[0]
  • Parent asset ID (collection): callback_response.data.asset_id
  • Task ID: callback_response.task_id
Frame Asset ID Format: Each frame asset ID follows the pattern imc_<parent_id>_<frame_index>, where:
  • imc_ is the prefix for image collection items
  • <parent_id> is the numerical portion of the parent asset ID
  • <frame_index> is the sequential frame number (0-indexed)

Notes

  • Frame extraction is processed asynchronously
  • Returns a task_id that can be used to track the extraction progress
  • Each extracted frame is assigned a unique asset ID that can be used to download or process the frame
  • The parent asset_id represents the image collection containing all frames
  • Suitable for thumbnail generation and video analysis

Authorizations

Authorization
string
header
required

Body

application/json
asset_id
string
required

The video asset ID to extract frames from

Example:

"re_657739295220518912"

Response

200 - application/json

Frame extraction initiated successfully

code
string

Response code indicating the result status

Example:

"0000"

msg
string

Response message describing the operation result

Example:

"success"

data
object

Response data object containing task information

success
boolean

Indicates whether the operation was successful

Example:

true

failed
boolean

Indicates whether the operation failed

Example:

false