OctoTube: Voice Search for YouTube

Alireza Kenarsari
Picovoice
Published in
2 min readNov 2, 2021

Have you ever been in a situation where you are going back and forth in a YouTube video searching for a specific phrase? No more. There is a little script that can search any video (even without transcription) lightning-fast and point you to the exact second the phrase occurs. Enter OctoTube!

Get Started

Clone the Octopus GitHub repository:

git clone --recurse-submodules https://github.com/Picovoice/octopus.git

Run this from the root of the repository to install Python dependencies:

pip3 install -r demo/youtube/requirements.txt

Get an AccessKey from Picovoice Console. It is free.

Find a video on YouTube you like to search and from the root of the repository run:

python3 demo/youtube/octotube.py \
--access-key ${ACCESS_KEY} \
--url ${YOUTUBE_VIDEO_URL} \
--phrases ${SEARCH_PHRASE0} ${SEARCH_PHRASE1}

You should get something like the below (yes, I watch too much Silicon Valley):

indexed 3024 seconds of audio in 54.36 secondssearched 3024 seconds of audio for 1 phrases in 0.01013 secondspied piper >>>[0.5] https://www.youtube.com/watch?v=Lt6PPiTTwbE&t=784[1.0] https://www.youtube.com/watch?v=Lt6PPiTTwbE&t=840[1.0] https://www.youtube.com/watch?v=Lt6PPiTTwbE&t=2355[1.0] https://www.youtube.com/watch?v=Lt6PPiTTwbE&t=2940

Notice that indexing is the bulk of the processing time. The good news is once the video is indexed, it is super fast to search for more (similar to how the Google search engine works):

searched 3024 seconds of audio for 1 phrases in 0.00655 secondsjian yang >>>[0.3] https://www.youtube.com/watch?v=Lt6PPiTTwbE&t=1332[0.7] https://www.youtube.com/watch?v=Lt6PPiTTwbE&t=2478

How Does it Work?

OctoTube uses the Picovoice Speech-to-Index engine (also known as Octopus). Octopus directly indexes audio without relying on a text representation (Learn more). Octopus runs on Android, iOS, Ubuntu, macOS, Windows, and even modern web browsers.

Start Building

Go to Octopus’s GitHub and start building your applications with Octopus!

--

--