Upload a Vision Event Video
Upload a video clip to your workspace and attach it to a Vision Event so reviewers can play it in the dashboard.
About
A video clip shows what happened around the moment a Vision Event was recorded, which a still image can miss. You can attach up to four clips to each event. Clips play in the event detail view of the dashboard (see View Event Details).
Videos must be MP4 or MOV files up to 3 GB. They are uploaded to your Workspace, not to a Project. MP4 files that browsers can play are stored as they are. Other videos are converted to H.264 MP4, and a very long video can fail conversion.
Edge Device Backup uploads clips recorded on the device for you. Use the steps on this page when you send events through the REST API.
HTTP API
Attaching a video takes three steps:
Prepare the upload. You get a
videoId, asignedUrl, andrequiredHeaders.Send the video file with a
PUTrequest tosignedUrl, with every header inrequiredHeaders. The URL expires after 60 minutes.Create the event with the
videoIdinvideos[].sourceId.
You do not need to wait for Roboflow to process the video before you create the event. The clip plays in the dashboard as soon as processing finishes. If processing fails, the event is kept and the dashboard shows the video as failed. If the file is never sent, the video stays pending and the dashboard keeps showing it as processing.
Required scope: vision-events:write or device:update to prepare an upload, and vision-events:read or device:read to read status or get a playback URL.
Prepare the Upload
Create a pending video in the workspace and return a signed URL to PUT the file to. Videos can be up to 3 GB. Reference the returned videoId in an event's videos array. Requires the vision-events:write or device:update scope.
Roboflow API key passed as a Bearer token.
File name of the video.
line-3-clip.mp4MIME type of the video file.
video/mp4Possible values: Upload prepared.
truePut this in videos[].sourceId when you create the event.
Kq4vX8mNp2RtY6wZ1bCdURL to PUT the video file to. It expires after 60 minutes.
https://storage.googleapis.com/...name is missing, contentType is not video/mp4 or video/quicktime, or the body has another field.
Missing or invalid API key.
Insufficient permissions for this resource.
Too many requests. Retry after a short wait.
POST /vision-events/videos/prepare-upload HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 52
{
"name": "line-3-clip.mp4",
"contentType": "video/mp4"
}{
"success": true,
"videoId": "Kq4vX8mNp2RtY6wZ1bCd",
"signedUrl": "https://storage.googleapis.com/...",
"requiredHeaders": {
"x-goog-content-length-range": "1,3221225472",
"x-goog-if-generation-match": "0"
}
}Then send the file to signedUrl. Copy each header from requiredHeaders into the request:
Nothing else is needed after the PUT. Roboflow starts processing the video when the file arrives.
Attach the Video to an Event
Put the videoId in the event's videos array when you create a Vision Event or batch create events.
Only videos prepared with this endpoint can be attached. A videoId from a dataset video upload, or from another workspace, is kept on the event but returns a warning and does not play.
Check the Upload Status
status is pending from the moment you prepare the upload until Roboflow finishes processing the file, then uploaded or failed. A video whose file never arrives stays pending.
Read the processing status and details of a video prepared for Vision Events. Requires the vision-events:read or device:read scope.
Roboflow API key passed as a Bearer token.
The videoId returned by Prepare a Vision Event Video Upload.
Video status.
Kq4vX8mNp2RtY6wZ1bCdpending from the moment the upload is prepared until Roboflow finishes processing the file, then uploaded or failed. A video whose file is never sent stays pending.
Public URL of a still frame from the video. It returns 404 until status is uploaded.
12.4video/mp418350080line-3-clip.mp4Missing or invalid API key.
Insufficient permissions for this resource.
The video does not exist, belongs to another workspace, or was not prepared for Vision Events.
Too many requests. Retry after a short wait.
GET /vision-events/videos/{videoId} HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"videoId": "Kq4vX8mNp2RtY6wZ1bCd",
"status": "pending",
"posterUrl": "text",
"durationSeconds": 12.4,
"contentType": "video/mp4",
"sizeBytes": 18350080,
"filename": "line-3-clip.mp4"
}Get a Playback URL
Query results list each video's sourceId and label only. Call this endpoint to get a URL that plays or downloads one video. The URL works for 60 minutes and is null until status is uploaded. Anyone holding the URL can play the clip, so do not cache or share it.
Return the video's status and details plus a signed URL that plays it. The response is sent with Cache-Control private, no-store. Requires the vision-events:read or device:read scope.
Roboflow API key passed as a Bearer token.
The videoId returned by Prepare a Vision Event Video Upload.
Video status and playback URL.
Kq4vX8mNp2RtY6wZ1bCdpending from the moment the upload is prepared until Roboflow finishes processing the file, then uploaded or failed. A video whose file is never sent stays pending.
Public URL of a still frame from the video. It returns 404 until status is uploaded.
12.4video/mp418350080line-3-clip.mp4Signed URL that plays the video. It expires after 60 minutes. null until status is uploaded.
Missing or invalid API key.
Insufficient permissions for this resource.
The video does not exist, belongs to another workspace, or was not prepared for Vision Events.
Too many requests. Retry after a short wait.
GET /vision-events/videos/{videoId}/url HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"videoId": "Kq4vX8mNp2RtY6wZ1bCd",
"status": "pending",
"posterUrl": "text",
"durationSeconds": 12.4,
"contentType": "video/mp4",
"sizeBytes": 18350080,
"filename": "line-3-clip.mp4",
"url": "text"
}Last updated
Was this helpful?