Vision Event ビデオをアップロード
動画クリップをワークスペースにアップロードし、Vision Event に添付すると、レビュー担当者がダッシュボードで再生できます。
概要
動画クリップには、次のような瞬間の前後で何が起きたかが映っています。 Vision Event 静止画像では捉えられないこともあります。各イベントには最大4本のクリップを添付できます。クリップはダッシュボードのイベント詳細ビューで再生されます( イベントの詳細を表示).
動画はMP4またはMOV形式で、最大3 GBまでです。動画はプロジェクトではなくワークスペースにアップロードされます。ブラウザーで再生できるMP4ファイルはそのまま保存されます。それ以外の動画はH.264 MP4に変換されます。非常に長い動画は変換に失敗する場合があります。
エッジデバイスのバックアップ では、デバイス上で録画されたクリップが自動的にアップロードされます。REST API経由でイベントを送信する場合は、このページの手順に従ってください。
HTTP API
動画の添付は、次の3つの手順で行います。
アップロードを準備します。
videoId、signedUrl、およびrequiredHeaders.動画ファイルを、次の宛先に
PUTリクエストで送信します。signedUrlその際、requiredHeadersに含まれるすべてのヘッダーを指定します。URLの有効期限は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/mp4可能な値: 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 の後に必要な操作はありません。ファイルが届くと、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"
}最終更新
役に立ちましたか?