Notebooks
G
Google Gemini
Analyze A Video Historic Event Recognition

Analyze A Video Historic Event Recognition

Copyright 2025 Google LLC.
[ ]

Gemini API: Analyze a Video - Historic Event Recognition

This notebook shows how you can use Gemini models' multimodal capabilities to recognize which historic event is happening in the video.

[1]
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 137.7/137.7 kB 2.6 MB/s eta 0:00:00

Configure your API key

To run the following cell, your API key must be stored in a Colab Secret named GOOGLE_API_KEY. If you don't already have an API key, or you're not sure how to create a Colab Secret, see Authentication for an example.

[2]

Example

This example uses video of President Ronald Reagan's Speech at the Berlin Wall taken on June 12 1987.

[3]
--2025-03-04 14:04:54--  https://s3.amazonaws.com/NARAprodstorage/opastorage/live/16/147/6014716/content/presidential-libraries/reagan/5730544/6-12-1987-439.mp4
Resolving s3.amazonaws.com (s3.amazonaws.com)... 52.217.89.118, 52.217.64.198, 52.216.106.21, ...
Connecting to s3.amazonaws.com (s3.amazonaws.com)|52.217.89.118|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 628645171 (600M) [video/mp4]
Saving to: ‘berlin.mp4’

berlin.mp4          100%[===================>] 599.52M  41.0MB/s    in 12s     

2025-03-04 14:05:07 (48.2 MB/s) - ‘berlin.mp4’ saved [628645171/628645171]

[4]
[5]
..............

The uploaded video is ready for processing. This prompt instructs the model to provide basic information about the historical events portrayed in the video.

[6]

Some historic events touch on controversial topics that may get flagged by Gemini API, which blocks the response for the query.

Because of this, it might be a good idea to turn off safety settings.

[7]
[9]
MODEL_ID
Certainly! Here's the information about the video:

Based on the video, here are the answers to your questions:

- **When did it happen?** This event happened on June 12, 1987.
- **Who is the most important person in the video?** The most important person in the video is Ronald Reagan, who was the President of the United States at the time.
- **How is the event called?** The event is commonly referred to as President Reagan's "Tear Down This Wall" speech.

As you can see, the model correctly provided information about the dates, Ronald Reagan, who was the main subject of the video, and the name of this event.

You can delete the video to prevent unnecessary data storage.

[10]
DeleteFileResponse()

Summary

Now you know how you can prompt Gemini models with videos and use them to recognize historic events.

This notebook shows only one of many use cases. Check the Video understanding notebook for more examples of using the Gemini API with videos.