Package google.cloud.videointelligence.v1

Index

VideoIntelligenceService

Service that implements the Video Intelligence API.

AnnotateVideo

rpc AnnotateVideo(AnnotateVideoRequest) returns (Operation)

Performs asynchronous video annotation. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains AnnotateVideoProgress (progress). Operation.response contains AnnotateVideoResponse (results).

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

AnnotateVideoProgress

Video annotation progress. Included in the metadata field of the Operation returned by the GetOperation call of the google::longrunning::Operations service.

Fields
annotation_progress[]

VideoAnnotationProgress

Progress metadata for all videos specified in AnnotateVideoRequest.

AnnotateVideoRequest

Video annotation request.

Fields
input_uri

string

Input video location. Currently, only Cloud Storage URIs are supported. URIs must be specified in the following format: gs://bucket-id/object-id (other URI formats return google.rpc.Code.INVALID_ARGUMENT). For more information, see Request URIs. To identify multiple videos, a video URI may include wildcards in the object-id. Supported wildcards: '*' to match 0 or more characters; '?' to match 1 character. If unset, the input video should be embedded in the request as input_content. If set, input_content must be unset.

input_content

bytes

The video data bytes. If unset, the input video(s) should be specified via the input_uri. If set, input_uri must be unset.

features[]

Feature

Required. Requested video annotation features.

video_context

VideoContext

Additional video context and/or feature-specific parameters.

output_uri

string

Optional. Location where the output (in JSON format) should be stored. Currently, only Cloud Storage URIs are supported. These must be specified in the following format: gs://bucket-id/object-id (other URI formats return google.rpc.Code.INVALID_ARGUMENT). For more information, see Request URIs.

location_id

string

Optional. Cloud region where annotation should take place. Supported cloud regions are: us-east1, us-west1, europe-west1, asia-east1. If no region is specified, the region will be determined based on video file location.

AnnotateVideoResponse

Video annotation response. Included in the response field of the Operation returned by the GetOperation call of the google::longrunning::Operations service.

Fields
annotation_results[]

VideoAnnotationResults

Annotation results for all videos specified in AnnotateVideoRequest.

DetectedAttribute

A generic detected attribute represented by name in string format.

Fields
name

string

The name of the attribute, for example, glasses, dark_glasses, mouth_open. A full list of supported type names will be provided in the document.

confidence

float

Detected attribute confidence. Range [0, 1].

value

string

Text value of the detection result. For example, the value for "HairColor" can be "black", "blonde", etc.

DetectedLandmark

A generic detected landmark represented by name in string format and a 2D location.

Fields
name

string

The name of this landmark, for example, left_hand, right_shoulder.

point

NormalizedVertex

The 2D point of the detected landmark using the normalized image coordindate system. The normalized coordinates have the range from 0 to 1.

confidence

float

The confidence score of the detected landmark. Range [0, 1].

Entity

Detected entity from video analysis.

Fields
entity_id

string

Opaque entity ID. Some IDs may be available in Google Knowledge Graph Search API.

description

string

Textual description, e.g., Fixed-gear bicycle.

language_code

string

Language code for description in BCP-47 format.

ExplicitContentAnnotation

Explicit content annotation (based on per-frame visual signals only). If no explicit content has been detected in a frame, no annotations are present for that frame.

Fields
frames[]

ExplicitContentFrame

All video frames where explicit content was detected.

version

string

Feature version.

ExplicitContentDetectionConfig

Config for EXPLICIT_CONTENT_DETECTION.

Fields
model

string

Model to use for explicit content detection. Supported values: "builtin/stable" (the default if unset) and "builtin/latest".

ExplicitContentFrame

Video frame level annotation results for explicit content.

Fields
time_offset

Duration

Time-offset, relative to the beginning of the video, corresponding to the video frame for this location.

pornography_likelihood

Likelihood

Likelihood of the pornography content..

FaceAnnotation

Deprecated. No effect.

Fields
thumbnail

bytes

Thumbnail of a representative face view (in JPEG format).

segments[]

FaceSegment

All video segments where a face was detected.

frames[]

FaceFrame

All video frames where a face was detected.

FaceDetectionAnnotation

Face detection annotation.

Fields
tracks[]

Track

The face tracks with attributes.

thumbnail

bytes

The thumbnail of a person's face.

version

string

Feature version.

FaceDetectionConfig

Config for FACE_DETECTION.

Fields
model

string

Model to use for face detection. Supported values: "builtin/stable" (the default if unset) and "builtin/latest".

include_bounding_boxes

bool

Whether bounding boxes are included in the face annotation output.

include_attributes

bool

Whether to enable face attributes detection, such as glasses, dark_glasses, mouth_open etc. Ignored if 'include_bounding_boxes' is set to false.

FaceFrame

Deprecated. No effect.

Fields
normalized_bounding_boxes[]

NormalizedBoundingBox

Normalized Bounding boxes in a frame. There can be more than one boxes if the same face is detected in multiple locations within the current frame.

time_offset

Duration

Time-offset, relative to the beginning of the video, corresponding to the video frame for this location.

FaceSegment

Video segment level annotation results for face detection.

Fields
segment

VideoSegment

Video segment where a face was detected.

Feature

Video annotation feature.

Enums
FEATURE_UNSPECIFIED Unspecified.
LABEL_DETECTION Label detection. Detect objects, such as dog or flower.
SHOT_CHANGE_DETECTION Shot change detection.
EXPLICIT_CONTENT_DETECTION Explicit content detection.
FACE_DETECTION Human face detection.
SPEECH_TRANSCRIPTION Speech transcription.
TEXT_DETECTION OCR text detection and tracking.
OBJECT_TRACKING Object detection and tracking.
LOGO_RECOGNITION Logo detection, tracking, and recognition.
PERSON_DETECTION Person detection.

LabelAnnotation

Label annotation.

Fields
entity

Entity

Detected entity.

category_entities[]

Entity

Common categories for the detected entity. For example, when the label is Terrier, the category is likely dog. And in some cases there might be more than one categories e.g., Terrier could also be a pet.

segments[]

LabelSegment

All video segments where a label was detected.

frames[]

LabelFrame

All video frames where a label was detected.

version

string

Feature version.

LabelDetectionConfig

Config for LABEL_DETECTION.

Fields
label_detection_mode

LabelDetectionMode

What labels should be detected with LABEL_DETECTION, in addition to video-level labels or segment-level labels. If unspecified, defaults to SHOT_MODE.

stationary_camera

bool

Whether the video has been shot from a stationary (i.e., non-moving) camera. When set to true, might improve detection accuracy for moving objects. Should be used with SHOT_AND_FRAME_MODE enabled.

model

string

Model to use for label detection. Supported values: "builtin/stable" (the default if unset) and "builtin/latest".

frame_confidence_threshold

float

The confidence threshold we perform filtering on the labels from frame-level detection. If not set, it is set to 0.4 by default. The valid range for this threshold is [0.1, 0.9]. Any value set outside of this range will be clipped. Note: For best results, follow the default threshold. We will update the default threshold everytime when we release a new model.

video_confidence_threshold

float

The confidence threshold we perform filtering on the labels from video-level and shot-level detections. If not set, it's set to 0.3 by default. The valid range for this threshold is [0.1, 0.9]. Any value set outside of this range will be clipped. Note: For best results, follow the default threshold. We will update the default threshold everytime when we release a new model.

LabelDetectionMode

Label detection mode.

Enums
LABEL_DETECTION_MODE_UNSPECIFIED Unspecified.
SHOT_MODE Detect shot-level labels.
FRAME_MODE Detect frame-level labels.
SHOT_AND_FRAME_MODE Detect both shot-level and frame-level labels.

LabelFrame

Video frame level annotation results for label detection.

Fields
time_offset

Duration

Time-offset, relative to the beginning of the video, corresponding to the video frame for this location.

confidence

float

Confidence that the label is accurate. Range: [0, 1].

LabelSegment

Video segment level annotation results for label detection.

Fields
segment

VideoSegment

Video segment where a label was detected.

confidence

float

Confidence that the label is accurate. Range: [0, 1].

Likelihood

Bucketized representation of likelihood.

Enums
LIKELIHOOD_UNSPECIFIED Unspecified likelihood.
VERY_UNLIKELY Very unlikely.
UNLIKELY Unlikely.
POSSIBLE Possible.
LIKELY Likely.
VERY_LIKELY Very likely.

LogoRecognitionAnnotation

Annotation corresponding to one detected, tracked and recognized logo class.

Fields
entity

Entity

Entity category information to specify the logo class that all the logo tracks within this LogoRecognitionAnnotation are recognized as.

tracks[]

Track

All logo tracks where the recognized logo appears. Each track corresponds to one logo instance appearing in consecutive frames.

segments[]

VideoSegment

All video segments where the recognized logo appears. There might be multiple instances of the same logo class appearing in one VideoSegment.

NormalizedBoundingBox

Normalized bounding box. The normalized vertex coordinates are relative to the original image. Range: [0, 1].

Fields
left

float

Left X coordinate.

top

float

Top Y coordinate.

right

float

Right X coordinate.

bottom

float

Bottom Y coordinate.

NormalizedBoundingPoly

Normalized bounding polygon for text (that might not be aligned with axis). Contains list of the corner points in clockwise order starting from top-left corner. For example, for a rectangular bounding box: When the text is horizontal it might look like: 0----1 | | 3----2

When it's clockwise rotated 180 degrees around the top-left corner it becomes: 2----3 | | 1----0

and the vertex order will still be (0, 1, 2, 3). Note that values can be less than 0, or greater than 1 due to trignometric calculations for location of the box.

Fields
vertices[]

NormalizedVertex

Normalized vertices of the bounding polygon.

NormalizedVertex

A vertex represents a 2D point in the image. NOTE: the normalized vertex coordinates are relative to the original image and range from 0 to 1.

Fields
x

float

X coordinate.

y

float

Y coordinate.

ObjectTrackingAnnotation

Annotations corresponding to one tracked object.

Fields
entity

Entity

Entity to specify the object category that this track is labeled as.

confidence

float

Object category's labeling confidence of this track.

frames[]

ObjectTrackingFrame

Information corresponding to all frames where this object track appears. Non-streaming batch mode: it may be one or multiple ObjectTrackingFrame messages in frames. Streaming mode: it can only be one ObjectTrackingFrame message in frames.

version

string

Feature version.

Union field track_info. Different representation of tracking info in non-streaming batch and streaming modes. track_info can be only one of the following:
segment

VideoSegment

Non-streaming batch mode ONLY. Each object track corresponds to one video segment where it appears.

track_id

int64

Streaming mode ONLY. In streaming mode, we do not know the end time of a tracked object before it is completed. Hence, there is no VideoSegment info returned. Instead, we provide a unique identifiable integer track_id so that the customers can correlate the results of the ongoing ObjectTrackAnnotation of the same track_id over time.

ObjectTrackingConfig

Config for OBJECT_TRACKING.

Fields
model

string

Model to use for object tracking. Supported values: "builtin/stable" (the default if unset) and "builtin/latest".

ObjectTrackingFrame

Video frame level annotations for object detection and tracking. This field stores per frame location, time offset, and confidence.

Fields
normalized_bounding_box

NormalizedBoundingBox

The normalized bounding box location of this object track for the frame.

time_offset

Duration

The timestamp of the frame in microseconds.

PersonDetectionAnnotation

Person detection annotation per video.

Fields
tracks[]

Track

The detected tracks of a person.

version

string

Feature version.

PersonDetectionConfig

Config for PERSON_DETECTION.

Fields
include_bounding_boxes

bool

Whether bounding boxes are included in the person detection annotation output.

include_pose_landmarks

bool

Whether to enable pose landmarks detection. Ignored if 'include_bounding_boxes' is set to false.

include_attributes

bool

Whether to enable person attributes detection, such as cloth color (black, blue, etc), type (coat, dress, etc), pattern (plain, floral, etc), hair, etc. Ignored if 'include_bounding_boxes' is set to false.

ShotChangeDetectionConfig

Config for SHOT_CHANGE_DETECTION.

Fields
model

string

Model to use for shot change detection. Supported values: "builtin/stable" (the default if unset) and "builtin/latest".

SpeechContext

Provides "hints" to the speech recognizer to favor specific words and phrases in the results.

Fields
phrases[]

string

Optional. A list of strings containing words and phrases "hints" so that the speech recognition is more likely to recognize them. This can be used to improve the accuracy for specific words and phrases, for example, if specific commands are typically spoken by the user. This can also be used to add additional words to the vocabulary of the recognizer. See usage limits.

SpeechRecognitionAlternative

Alternative hypotheses (a.k.a. n-best list).

Fields
transcript

string

Transcript text representing the words that the user spoke.

confidence

float

Output only. The confidence estimate between 0.0 and 1.0. A higher number indicates an estimated greater likelihood that the recognized words are correct. This field is set only for the top alternative. This field is not guaranteed to be accurate and users should not rely on it to be always provided. The default of 0.0 is a sentinel value indicating confidence was not set.

words[]

WordInfo

Output only. A list of word-specific information for each recognized word. Note: When enable_speaker_diarization is set to true, you will see all the words from the beginning of the audio.

SpeechTranscription

A speech recognition result corresponding to a portion of the audio.

Fields
alternatives[]

SpeechRecognitionAlternative

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

language_code

string

Output only. The BCP-47 language tag of the language in this result. This language code was detected to have the most likelihood of being spoken in the audio.

SpeechTranscriptionConfig

Config for SPEECH_TRANSCRIPTION.

Fields
language_code

string

Required. Required The language of the supplied audio as a BCP-47 language tag. Example: "en-US". See Language Support for a list of the currently supported language codes.

max_alternatives

int32

Optional. Maximum number of recognition hypotheses to be returned. Specifically, the maximum number of SpeechRecognitionAlternative messages within each SpeechTranscription. The server may return fewer than max_alternatives. Valid values are 0-30. A value of 0 or 1 will return a maximum of one. If omitted, will return a maximum of one.

filter_profanity

bool

Optional. If set to true, the server will attempt to filter out profanities, replacing all but the initial character in each filtered word with asterisks, e.g. "f***". If set to false or omitted, profanities won't be filtered out.

speech_contexts[]

SpeechContext

Optional. A means to provide context to assist the speech recognition.

enable_automatic_punctuation

bool

Optional. If 'true', adds punctuation to recognition result hypotheses. This feature is only available in select languages. Setting this for requests in other languages has no effect at all. The default 'false' value does not add punctuation to result hypotheses. NOTE: "This is currently offered as an experimental service, complimentary to all users. In the future this may be exclusively available as a premium feature."

audio_tracks[]

int32

Optional. For file formats, such as MXF or MKV, supporting multiple audio tracks, specify up to two tracks. Default: track 0.

enable_speaker_diarization

bool

Optional. If 'true', enables speaker detection for each recognized word in the top alternative of the recognition result using a speaker_tag provided in the WordInfo. Note: When this is true, we send all the words from the beginning of the audio for the top alternative in every consecutive response. This is done in order to improve our speaker tags as our models learn to identify the speakers in the conversation over time.

diarization_speaker_count

int32

Optional. If set, specifies the estimated number of speakers in the conversation. If not set, defaults to '2'. Ignored unless enable_speaker_diarization is set to true.

enable_word_confidence

bool

Optional. If true, the top result includes a list of words and the confidence for those words. If false, no word-level confidence information is returned. The default is false.

TextAnnotation

Annotations related to one detected OCR text snippet. This will contain the corresponding text, confidence value, and frame level information for each detection.

Fields
text

string

The detected text.

segments[]

TextSegment

All video segments where OCR detected text appears.

version

string

Feature version.

TextDetectionConfig

Config for TEXT_DETECTION.

Fields
language_hints[]

string

Language hint can be specified if the language to be detected is known a priori. It can increase the accuracy of the detection. Language hint must be language code in BCP-47 format.

Automatic language detection is performed if no hint is provided.

model

string

Model to use for text detection. Supported values: "builtin/stable" (the default if unset) and "builtin/latest".

TextFrame

Video frame level annotation results for text annotation (OCR). Contains information regarding timestamp and bounding box locations for the frames containing detected OCR text snippets.

Fields
rotated_bounding_box

NormalizedBoundingPoly

Bounding polygon of the detected text for this frame.

time_offset

Duration

Timestamp of this frame.

TextSegment

Video segment level annotation results for text detection.

Fields
segment

VideoSegment

Video segment where a text snippet was detected.

confidence

float

Confidence for the track of detected text. It is calculated as the highest over all frames where OCR detected text appears.

frames[]

TextFrame

Information related to the frames where OCR detected text appears.

TimestampedObject

For tracking related features. An object at time_offset with attributes, and located with normalized_bounding_box.

Fields
normalized_bounding_box

NormalizedBoundingBox

Normalized Bounding box in a frame, where the object is located.

time_offset

Duration

Time-offset, relative to the beginning of the video, corresponding to the video frame for this object.

attributes[]

DetectedAttribute

Optional. The attributes of the object in the bounding box.

landmarks[]

DetectedLandmark

Optional. The detected landmarks.

Track

A track of an object instance.

Fields
segment

VideoSegment

Video segment of a track.

timestamped_objects[]

TimestampedObject

The object with timestamp and attributes per frame in the track.

attributes[]

DetectedAttribute

Optional. Attributes in the track level.

confidence

float

Optional. The confidence score of the tracked object.

VideoAnnotationProgress

Annotation progress for a single video.

Fields
input_uri

string

Video file location in Cloud Storage.

progress_percent

int32

Approximate percentage processed thus far. Guaranteed to be 100 when fully processed.

start_time

Timestamp

Time when the request was received.

update_time

Timestamp

Time of the most recent update.

feature

Feature

Specifies which feature is being tracked if the request contains more than one feature.

segment

VideoSegment

Specifies which segment is being tracked if the request contains more than one segment.

VideoAnnotationResults

Annotation results for a single video.

Fields
input_uri

string

Video file location in Cloud Storage.

segment

VideoSegment

Video segment on which the annotation is run.

segment_label_annotations[]

LabelAnnotation

Topical label annotations on video level or user-specified segment level. There is exactly one element for each unique label.

segment_presence_label_annotations[]

LabelAnnotation

Presence label annotations on video level or user-specified segment level. There is exactly one element for each unique label. Compared to the existing topical segment_label_annotations, this field presents more fine-grained, segment-level labels detected in video content and is made available only when the client sets LabelDetectionConfig.model to "builtin/latest" in the request.

shot_label_annotations[]

LabelAnnotation

Topical label annotations on shot level. There is exactly one element for each unique label.

shot_presence_label_annotations[]

LabelAnnotation

Presence label annotations on shot level. There is exactly one element for each unique label. Compared to the existing topical shot_label_annotations, this field presents more fine-grained, shot-level labels detected in video content and is made available only when the client sets LabelDetectionConfig.model to "builtin/latest" in the request.

frame_label_annotations[]

LabelAnnotation

Label annotations on frame level. There is exactly one element for each unique label.

face_annotations[]
(deprecated)

FaceAnnotation

Deprecated. Please use face_detection_annotations instead.

face_detection_annotations[]

FaceDetectionAnnotation

Face detection annotations.

shot_annotations[]

VideoSegment

Shot annotations. Each shot is represented as a video segment.

explicit_annotation

ExplicitContentAnnotation

Explicit content annotation.

speech_transcriptions[]

SpeechTranscription

Speech transcription.

text_annotations[]

TextAnnotation

OCR text detection and tracking. Annotations for list of detected text snippets. Each will have list of frame information associated with it.

object_annotations[]

ObjectTrackingAnnotation

Annotations for list of objects detected and tracked in video.

logo_recognition_annotations[]

LogoRecognitionAnnotation

Annotations for list of logos detected, tracked and recognized in video.

person_detection_annotations[]

PersonDetectionAnnotation

Person detection annotations.

error

Status

If set, indicates an error. Note that for a single AnnotateVideoRequest some videos may succeed and some may fail.

VideoContext

Video context and/or feature-specific parameters.

Fields
segments[]

VideoSegment

Video segments to annotate. The segments may overlap and are not required to be contiguous or span the whole video. If unspecified, each video is treated as a single segment.

label_detection_config

LabelDetectionConfig

Config for LABEL_DETECTION.

shot_change_detection_config

ShotChangeDetectionConfig

Config for SHOT_CHANGE_DETECTION.

explicit_content_detection_config

ExplicitContentDetectionConfig

Config for EXPLICIT_CONTENT_DETECTION.

face_detection_config

FaceDetectionConfig

Config for FACE_DETECTION.

speech_transcription_config

SpeechTranscriptionConfig

Config for SPEECH_TRANSCRIPTION.

text_detection_config

TextDetectionConfig

Config for TEXT_DETECTION.

person_detection_config

PersonDetectionConfig

Config for PERSON_DETECTION.

object_tracking_config

ObjectTrackingConfig

Config for OBJECT_TRACKING.

VideoSegment

Video segment.

Fields
start_time_offset

Duration

Time-offset, relative to the beginning of the video, corresponding to the start of the segment (inclusive).

end_time_offset

Duration

Time-offset, relative to the beginning of the video, corresponding to the end of the segment (inclusive).

WordInfo

Word-specific information for recognized words. Word information is only included in the response when certain request parameters are set, such as enable_word_time_offsets.

Fields
start_time

Duration

Time offset relative to the beginning of the audio, and corresponding to the start of the spoken word. This field is only set if enable_word_time_offsets=true and only in the top hypothesis. This is an experimental feature and the accuracy of the time offset can vary.

end_time

Duration

Time offset relative to the beginning of the audio, and corresponding to the end of the spoken word. This field is only set if enable_word_time_offsets=true and only in the top hypothesis. This is an experimental feature and the accuracy of the time offset can vary.

word

string

The word corresponding to this set of information.

confidence

float

Output only. The confidence estimate between 0.0 and 1.0. A higher number indicates an estimated greater likelihood that the recognized words are correct. This field is set only for the top alternative. This field is not guaranteed to be accurate and users should not rely on it to be always provided. The default of 0.0 is a sentinel value indicating confidence was not set.

speaker_tag

int32

Output only. A distinct integer value is assigned for every speaker within the audio. This field specifies which one of those speakers was detected to have spoken this word. Value ranges from 1 up to diarization_speaker_count, and is only set if speaker diarization is enabled.