Video Intelligence#

Google Cloud Video Intelligence API makes videos searchable, and discoverable, by extracting metadata with an easy to use API. You can now search every moment of every video file in your catalog and find every occurrence as well as its significance. It quickly annotates videos stored in Google Cloud Storage, and helps you identify key nouns entities of your video, and when they occur within the video. Separate signal from noise, by retrieving relevant information at the video, shot or per frame.

Authentication and Configuration#

  • For an overview of authentication in google-cloud-python, see Authentication.

  • In addition to any authentication configuration, you should also set the GOOGLE_CLOUD_PROJECT environment variable for the project you’d like to interact with. If the GOOGLE_CLOUD_PROJECT environment variable is not present, the project ID from JSON file credentials is used.

    If you are using Google App Engine or Google Compute Engine this will be detected automatically.

  • After configuring your environment, create a VideoIntelligenceServiceClient.

>>> from google.cloud import videointelligence
>>> client = videointelligence.VideoIntelligenceServiceClient()

or pass in credentials explicitly.

>>> from google.cloud import videointelligence
>>> client = videointelligence.VideoIntelligenceServiceClient(
...     credentials=creds,
... )

Annotating a Video#

To annotate a video, just determine which annotation features you want, and point the API at your video:

>>> from google.cloud import videointelligence
>>>
>>> client = videointelligence.VideoIntelligenceServiceClient()
>>> result = client.annotate_video(
...     input_uri='gs://cloudmleap/video/next/animals.mp4',
...     features=['LABEL_DETECTION', 'SHOT_CHANGE_DETECTION'],
... ).result()
>>> result.annotationResults[0].labelAnnotations[0].description
'Android'
>>> result.annotationResults[0].labelAnnotations[1].description
'Animation'

API Reference#

This package includes clients for multiple versions of the Video Intelligence API. By default, you will get v1, the latest stable version.

A new beta release with additional features over the current stable version, spelled v1p1beta1, is provided to allow you to use these new features. These are expected to move into the stable release soon; until then, the usual beta admonishment (changes are possible, etc.) applies.

An API and type reference is provided for this beta:

The previous beta releases, spelled v1beta1 and v1beta2, are provided to continue to support code previously written against them. In order to use this, you will want to import from google.cloud.videointelligence_v1beta2 in lieu of google.cloud.videointelligence_v1.

An API and type reference is provided the these betas also:

For a list of all google-cloud-videointelligence releases: