비전 이벤트 비디오 업로드
작업 공간에 비디오 클립을 업로드하고 Vision 이벤트에 첨부하면 검토자가 대시보드에서 재생할 수 있습니다.
개요
비디오 클립에는 다음 상황이 발생한 순간 전후의 모습이 담겨 있습니다. 비전 이벤트 정지 이미지에는 놓칠 수 있는 장면입니다. 각 이벤트에 최대 4개의 클립을 첨부할 수 있습니다. 클립은 대시보드의 이벤트 세부정보 보기에서 재생됩니다(자세한 내용은 이벤트 세부정보 보기).
비디오는 최대 3GB의 MP4 또는 MOV 파일이어야 합니다. 비디오는 프로젝트가 아니라 워크스페이스에 업로드됩니다. 브라우저에서 재생할 수 있는 MP4 파일은 변환 없이 그대로 저장됩니다. 그 밖의 비디오는 H.264 MP4로 변환되며, 너무 긴 비디오는 변환에 실패할 수 있습니다.
엣지 디바이스 백업 에서는 디바이스에 녹화된 클립을 대신 업로드합니다. REST API를 통해 이벤트를 전송할 때는 이 페이지의 단계를 따르세요.
HTTP API
비디오를 첨부하는 과정은 다음 세 단계로 이루어집니다.
업로드를 준비합니다. 그러면
videoId,signedUrl, 그리고requiredHeaders.다음과 같이 동영상 파일을 전송합니다:
PUT요청을signedUrl에 보내고,requiredHeadersURL은 60분 후 만료됩니다.이벤트를 다음 항목으로
videoId의videos[].sourceId.
이벤트를 만들기 전에 Roboflow가 동영상 처리를 완료할 때까지 기다릴 필요는 없습니다. 처리가 완료되는 즉시 대시보드에서 클립을 재생할 수 있습니다. 처리가 실패해도 이벤트는 유지되며, 대시보드에는 동영상이 실패한 것으로 표시됩니다. 파일이 전송되지 않으면 동영상은 pending 상태로 유지되고 대시보드에는 계속 처리 중인 것으로 표시됩니다.
필수 권한 범위: vision-events:write 또는 device:update 업로드를 준비하려면 vision-events:read 또는 device:read 상태를 읽거나 재생 URL을 가져오려면
업로드 준비
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"
}
}그런 다음 파일을 다음으로 전송합니다: signedUrl. 각 헤더를 다음에서 복사합니다. requiredHeaders 요청에 추가합니다:
다음 PUT 이후에는 PUT추가로 필요한 작업은 없습니다. 파일이 도착하면 Roboflow가 동영상 처리를 시작합니다.
비디오를 이벤트에 연결
이벤트의 videoId 를 videos 배열에 넣고 Vision Event를 생성하거나 또는 이벤트를 일괄 생성하세요.
이 엔드포인트로 준비한 비디오만 연결할 수 있습니다. 데이터셋 비디오 업로드 또는 다른 워크스페이스에서 가져온 videoId 는 이벤트에 저장되지만 경고가 반환되고 재생되지 않습니다.
업로드 상태 확인
status 는 pending 이며, 업로드를 준비한 시점부터 Roboflow가 파일 처리를 마칠 때까지 이 상태가 유지된 후 uploaded 또는 failed가 됩니다. 파일이 끝내 도착하지 않은 비디오는 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"
}재생 URL 가져오기
쿼리 결과에는 각 비디오의 sourceId 와 label 만 표시됩니다. 비디오를 재생하거나 다운로드할 수 있는 URL을 얻으려면 이 엔드포인트를 호출하세요. URL은 60분 동안 유효하며 null 입니다. 이는 status 가 uploaded가 될 때까지 적용됩니다. URL을 가진 사람은 누구나 클립을 재생할 수 있으므로 URL을 캐시하거나 공유하지 마세요.
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"
}마지막 업데이트
도움이 되었나요?