Detecting Shot Changes with the Video Intelligence API

30 minutes
  • 5 Learning Objectives

About this Hands-on Lab

Detecting when a shot changes in a video is a foundational step when it comes to video indexing. Google Cloud Video Intelligence API is capable of processing digital video to output the beginning and ending time code, demarking individual moments taken by a single camera and representing a continuous time and space. In this lab, you’ll use a Python script to process a digital video with the Video Intelligence API’s annotate function to output a series of individual shots and then compare the timestamps to the original video.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Enable API

Enable the Video Intelligence API.

Retrieve the Working Files
  1. Activate the Cloud Shell.
  2. Clone the desired repository.
  3. Change directory to the working files.
Set Up Service Account
  1. Launch the Editor.
  2. Expand the content-google-cloud-certified-professional-machine-learning-engineer folder.
  3. Name the file key.json.
  4. From this hands-on lab credentials, copy the Service Account Credentials.
  5. Save the file.
  6. Switch to the Terminal to export the key.json file.
Send Request to Video Intelligence API
  1. Execute the Python command to call the Video Intelligence API and pass in the digital video file path as an argument:

Verify Output

Compare output shot change time codes to actual video for validtion of process.

Additional Resources

Your company has been awarded a government contract to establish search capabilities for a large video archive. You have been asked to validate the output of the Video Intelligence API when applied to a sample video.


  • GitHub repository:

  • Video sample:

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?