Setup
1
Create an API key
First create an API key using the instructions in API keys
2
3
Create an index
Next, create an index. For this tutorial, we will use an index with the name ‘test_index’

Indexing the movie
The first step is to create an index to store and process the movie.Replace
movie_file
with the absolute path to the movie you want to index on your disk.It may take a while for the video to be uploaded to the server so do check after a while if it doesn’t appear initially.
Finding scenes
Using text
One of the cool things you can do with AskVideos is search through the visual content of the video with text. For example if we wanted to find all the scenes where someone’s wearing a cowboy hat (it is set in Texas after all!), we could enter that as the query to the search API.top_k
to be 10.
Each result has an associated confidence score along with start and end timestamps.
Here are what the results look like:

Using images
Now let’s try using an image to search! Images can be powerful search queries when we are trying to describe a vibe or particular scene with a lot of things happening in it. Let’s try to find a specific scene that is shown in the trailer using an image.

Using videos
If we have a video we would like to use as our search query, we can do that too!start_seconds
and end_seconds
that specify which segment of the query video to use for the search. Note that these variables relate to the video we are using as our query and not the other videos that are in the index.


Answer Engine
We can also use language models in the AskVideos API to do various tasks ask questions and synthesize answers from our videos or ‘chat’ with a video.