Skip to main content
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": 200,
  "msg": "success",
  "data": {
    "task_id": "1e8ae1075e054e8abb58e7598c53cbf1"
  },
  "failed": false,
  "success": true
}
This endpoint automatically extracts frames from a video file at regular intervals.
This is an async endpoint. You must configure a webhook URL in Webhooks Settings before calling this endpoint, otherwise you will not receive the processing results. See Webhooks Configuration Guide for details.
Pricing:
  • $0.01/second of video

Code Examples

const BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2";
const API_KEY = "sk-mai-this_a_test_string_please_use_your_generated_key_during_testing";

const response = await fetch(`${BASE_URL}/video/extract-frames`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': API_KEY
  },
  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": 200,
  "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 (200 indicates success)
messagestringStatus message (e.g., “SUCCESS”)
dataobjectResponse data object containing the extracted frame information
data.asset_ch_idsarrayArray of individual frame asset IDs. Use any asset_ch_id with the Download or Get Metadata endpoint to download or query a single frame image.
data.asset_idstringThe parent group asset ID for the entire frame collection. Use this ID with the Download endpoint to download all frames as a zip package, or with Get Metadata to list all frames in this collection.
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: 200
├── 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)
Using the returned IDs:
IDDownload endpoint returnsGet Metadata endpoint returns
asset_id (e.g., im_666914042514116608)A zip package containing all extracted framesA list of all frames in the collection
asset_ch_ids[n] (e.g., imc_666914042514116608_0)A single frame imageMetadata for that specific frame
# Download a single frame
download_asset("imc_666914042514116608_0")  # → single image file

# Download all frames as a zip
download_asset("im_666914042514116608")  # → zip package with all frames

Notes

  • Frame extraction is processed asynchronously
  • Returns a task_id that can be used to track the extraction progress
  • Both asset_id and asset_ch_ids can be used with the Download and Get Metadata endpoints
  • The parent asset_id downloads all frames as a zip package; individual asset_ch_ids download single frame images
  • 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:

200

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