1 // Copyright 2017 Google Inc.
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
17 package google.cloud.videointelligence.v1beta1;
19 import "google/api/annotations.proto";
20 import "google/longrunning/operations.proto";
21 import "google/protobuf/timestamp.proto";
22 import "google/rpc/status.proto";
24 option csharp_namespace = "Google.Cloud.VideoIntelligence.V1Beta1";
25 option go_package = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta1;videointelligence";
26 option java_multiple_files = true;
27 option java_outer_classname = "VideoIntelligenceServiceProto";
28 option java_package = "com.google.cloud.videointelligence.v1beta1";
29 option php_namespace = "Google\\Cloud\\VideoIntelligence\\V1beta1";
31 // Service that implements Google Cloud Video Intelligence API.
32 service VideoIntelligenceService {
33 // Performs asynchronous video annotation. Progress and results can be
34 // retrieved through the `google.longrunning.Operations` interface.
35 // `Operation.metadata` contains `AnnotateVideoProgress` (progress).
36 // `Operation.response` contains `AnnotateVideoResponse` (results).
37 rpc AnnotateVideo(AnnotateVideoRequest)
38 returns (google.longrunning.Operation) {
39 option (google.api.http) = {
40 post: "/v1beta1/videos:annotate"
46 // Video annotation request.
47 message AnnotateVideoRequest {
48 // Input video location. Currently, only
49 // [Google Cloud Storage](https://cloud.google.com/storage/) URIs are
50 // supported, which must be specified in the following format:
51 // `gs://bucket-id/object-id` (other URI formats return
52 // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For
53 // more information, see [Request URIs](/storage/docs/reference-uris). A video
54 // URI may include wildcards in `object-id`, and thus identify multiple
55 // videos. Supported wildcards: '*' to match 0 or more characters;
56 // '?' to match 1 character. If unset, the input video should be embedded
57 // in the request as `input_content`. If set, `input_content` should be unset.
60 // The video data bytes. Encoding: base64. If unset, the input video(s)
61 // should be specified via `input_uri`. If set, `input_uri` should be unset.
62 string input_content = 6;
64 // Requested video annotation features.
65 repeated Feature features = 2;
67 // Additional video context and/or feature-specific parameters.
68 VideoContext video_context = 3;
70 // Optional location where the output (in JSON format) should be stored.
71 // Currently, only [Google Cloud Storage](https://cloud.google.com/storage/)
72 // URIs are supported, which must be specified in the following format:
73 // `gs://bucket-id/object-id` (other URI formats return
74 // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For
75 // more information, see [Request URIs](/storage/docs/reference-uris).
76 string output_uri = 4;
78 // Optional cloud region where annotation should take place. Supported cloud
79 // regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region
80 // is specified, a region will be determined based on video file location.
81 string location_id = 5;
84 // Video context and/or feature-specific parameters.
85 message VideoContext {
86 // Video segments to annotate. The segments may overlap and are not required
87 // to be contiguous or span the whole video. If unspecified, each video
88 // is treated as a single segment.
89 repeated VideoSegment segments = 1;
91 // If label detection has been requested, what labels should be detected
92 // in addition to video-level labels or segment-level labels. If unspecified,
93 // defaults to `SHOT_MODE`.
94 LabelDetectionMode label_detection_mode = 2;
96 // Whether the video has been shot from a stationary (i.e. non-moving) camera.
97 // When set to true, might improve detection accuracy for moving objects.
98 bool stationary_camera = 3;
100 // Model to use for label detection.
101 // Supported values: "latest" and "stable" (the default).
102 string label_detection_model = 4;
104 // Model to use for face detection.
105 // Supported values: "latest" and "stable" (the default).
106 string face_detection_model = 5;
108 // Model to use for shot change detection.
109 // Supported values: "latest" and "stable" (the default).
110 string shot_change_detection_model = 6;
112 // Model to use for safe search detection.
113 // Supported values: "latest" and "stable" (the default).
114 string safe_search_detection_model = 7;
118 message VideoSegment {
119 // Start offset in microseconds (inclusive). Unset means 0.
120 int64 start_time_offset = 1;
122 // End offset in microseconds (inclusive). Unset means 0.
123 int64 end_time_offset = 2;
127 message LabelLocation {
128 // Video segment. Set to [-1, -1] for video-level labels.
129 // Set to [timestamp, timestamp] for frame-level labels.
130 // Otherwise, corresponds to one of `AnnotateSpec.segments`
131 // (if specified) or to shot boundaries (if requested).
132 VideoSegment segment = 1;
134 // Confidence that the label is accurate. Range: [0, 1].
135 float confidence = 2;
138 LabelLevel level = 3;
142 message LabelAnnotation {
143 // Textual description, e.g. `Fixed-gear bicycle`.
144 string description = 1;
146 // Language code for `description` in BCP-47 format.
147 string language_code = 2;
149 // Where the label was detected and with what confidence.
150 repeated LabelLocation locations = 3;
153 // Safe search annotation (based on per-frame visual signals only).
154 // If no unsafe content has been detected in a frame, no annotations
155 // are present for that frame. If only some types of unsafe content
156 // have been detected in a frame, the likelihood is set to `UNKNOWN`
157 // for all other types of unsafe content.
158 message SafeSearchAnnotation {
159 // Likelihood of adult content.
160 Likelihood adult = 1;
162 // Likelihood that an obvious modification was made to the original
163 // version to make it appear funny or offensive.
164 Likelihood spoof = 2;
166 // Likelihood of medical content.
167 Likelihood medical = 3;
169 // Likelihood of violent content.
170 Likelihood violent = 4;
172 // Likelihood of racy content.
175 // Video time offset in microseconds.
176 int64 time_offset = 6;
180 message BoundingBox {
181 // Left X coordinate.
184 // Right X coordinate.
187 // Bottom Y coordinate.
195 message FaceLocation {
196 // Bounding box in a frame.
197 BoundingBox bounding_box = 1;
199 // Video time offset in microseconds.
200 int64 time_offset = 2;
204 message FaceAnnotation {
205 // Thumbnail of a representative face view (in JPEG format). Encoding: base64.
206 string thumbnail = 1;
208 // All locations where a face was detected.
209 // Faces are detected and tracked on a per-video basis
210 // (as opposed to across multiple videos).
211 repeated VideoSegment segments = 2;
213 // Face locations at one frame per second.
214 repeated FaceLocation locations = 3;
217 // Annotation results for a single video.
218 message VideoAnnotationResults {
219 // Video file location in
220 // [Google Cloud Storage](https://cloud.google.com/storage/).
221 string input_uri = 1;
223 // Label annotations. There is exactly one element for each unique label.
224 repeated LabelAnnotation label_annotations = 2;
226 // Face annotations. There is exactly one element for each unique face.
227 repeated FaceAnnotation face_annotations = 3;
229 // Shot annotations. Each shot is represented as a video segment.
230 repeated VideoSegment shot_annotations = 4;
232 // Safe search annotations.
233 repeated SafeSearchAnnotation safe_search_annotations = 6;
235 // If set, indicates an error. Note that for a single `AnnotateVideoRequest`
236 // some videos may succeed and some may fail.
237 google.rpc.Status error = 5;
240 // Video annotation response. Included in the `response`
241 // field of the `Operation` returned by the `GetOperation`
242 // call of the `google::longrunning::Operations` service.
243 message AnnotateVideoResponse {
244 // Annotation results for all videos specified in `AnnotateVideoRequest`.
245 repeated VideoAnnotationResults annotation_results = 1;
248 // Annotation progress for a single video.
249 message VideoAnnotationProgress {
250 // Video file location in
251 // [Google Cloud Storage](https://cloud.google.com/storage/).
252 string input_uri = 1;
254 // Approximate percentage processed thus far.
255 // Guaranteed to be 100 when fully processed.
256 int32 progress_percent = 2;
258 // Time when the request was received.
259 google.protobuf.Timestamp start_time = 3;
261 // Time of the most recent update.
262 google.protobuf.Timestamp update_time = 4;
265 // Video annotation progress. Included in the `metadata`
266 // field of the `Operation` returned by the `GetOperation`
267 // call of the `google::longrunning::Operations` service.
268 message AnnotateVideoProgress {
269 // Progress metadata for all videos specified in `AnnotateVideoRequest`.
270 repeated VideoAnnotationProgress annotation_progress = 1;
273 // Video annotation feature.
276 FEATURE_UNSPECIFIED = 0;
278 // Label detection. Detect objects, such as dog or flower.
281 // Human face detection and tracking.
284 // Shot change detection.
285 SHOT_CHANGE_DETECTION = 3;
287 // Safe search detection.
288 SAFE_SEARCH_DETECTION = 4;
291 // Label level (scope).
294 LABEL_LEVEL_UNSPECIFIED = 0;
296 // Video-level. Corresponds to the whole video.
299 // Segment-level. Corresponds to one of `AnnotateSpec.segments`.
302 // Shot-level. Corresponds to a single shot (i.e. a series of frames
303 // without a major camera position or background change).
306 // Frame-level. Corresponds to a single video frame.
310 // Label detection mode.
311 enum LabelDetectionMode {
313 LABEL_DETECTION_MODE_UNSPECIFIED = 0;
315 // Detect shot-level labels.
318 // Detect frame-level labels.
321 // Detect both shot-level and frame-level labels.
322 SHOT_AND_FRAME_MODE = 3;
325 // Bucketized representation of likelihood.
327 // Unknown likelihood.