Extract Video
Extract Video API Documentation
Description
This endpoint extracts structured data from video files based on a user-defined prompt. It supports input via URL or base64-encoded video content and uses vision-capable Large Language Models (LLMs) to interpret and extract relevant information from the videos.
Please note that this endpoint is charged per second of video duration!
Endpoint
Headers
- Content-Type:
application/json
- Authorization: Bearer
<API_KEY>
(required)
Request Body
Responses
Success (200)
Returns the extracted data based on the provided prompt, along with additional information.
- Content-Type: application/json
- X-RateLimit-Limit: The rate limit for the user.
- X-RateLimit-Remaining: The remaining number of requests for the user.
Bad Request (400)
Returned if the request is invalid or the video file exceeds size or duration limits.
Unauthorized (401)
Returned if the API key is invalid or missing.
Internal Server Error (500)
Returned if there’s an error during the video extraction process.
Example Request
Notes
- The maximum file size for a video is 2GB.
- The maximum video duration is 1 hour (3600 seconds).
- Supported video formats: mp4, mpeg, mov, avi, flv, mpg, webm, wmv, 3gpp
- Credit usage:
- Base cost: 10 credits
- Additional 1 credit per second of video duration
- The total credit usage is returned in the response as
creditUsage
. - If using the URL method, ensure the video is publicly accessible.
- The
jsonMode
parameter determines whether the output is formatted as JSON (true) or plain text (false). - The endpoint uses the Gemini 1.5 Pro model for video analysis and data extraction.
- Temporary files are created during processing and are deleted after use.
- You can get a list of supported video formats by calling:
Rate Limiting
Rate limit headers (X-RateLimit-Limit
and X-RateLimit-Remaining
) are included in the response to indicate the user’s current rate limit status.
Error Handling
- If the required parameters (
video
orprompt
) are missing, a 400 Bad Request error is returned. - If the video file size exceeds 2GB, a 400 Bad Request error is returned.
- If the video duration exceeds 1 hour, a 400 Bad Request error is returned.
- If there’s an error during extraction, a 500 Internal Server Error is returned with details about the failure.
Security and Privacy
- Uploaded videos are temporarily stored and then deleted after processing.
- Video metadata (including duration) is checked using a separate Python service before processing.