Skip to content

This script returns the the timestamp of a sentence from a user queries that was said in a video

Notifications You must be signed in to change notification settings

DittoOne/Timestamp-it

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Timestamp-it

πŸ—£οΈ Video Speech Timestamp Finder

A Python tool to find when a specific phrase is spoken in a video using OpenAI’s Whisper.
It transcribes your video once (caching the result) and allows you to search for phrases laterβ€”fast!


✨ Features

  • βœ… Transcribes video audio using Whisper (tiny model for speed)
  • πŸ“¦ Caches transcript automatically for faster repeated queries
  • πŸ” Returns precise timestamps (seconds) where your query phrase is said
  • 🧠 Supports fuzzy/approximate matching for inexact phrases
  • 🧹 Includes utility to clear cached transcripts

πŸ“¦ Tech Stack

  • Python 3.x
  • openai/whisper
  • re (regular expressions)
  • difflib
  • pickle
  • OS

πŸš€ Getting Started

πŸ› οΈ Prerequisites

Install required Python packages:

pip install git+https://github.com/openai/whisper.git
pip install torch

πŸ“₯ Installation

Clone or download this repo, or just copy the script into your project.


🧠 How It Works

1️⃣ First time:

  • Loads Whisper β€œtiny” model for fast transcription
  • Saves the transcript as a .pkl file for caching

2️⃣ On later runs:

  • Loads the cached transcript instantly
  • Searches text segments for your query

3️⃣ Matching:

  • Exact or substring matches
  • Fuzzy matching for long phrases
  • Partial word matches for multi-word queries

βš™οΈ Usage Example

πŸ‘‰ Import and call in Python:

from your_module_name import get_timestamp_for_query

video_path = "your_video.mp4"
query = "your search phrase"

timestamp = get_timestamp_for_query(video_path, query)
print(f"Found at: {timestamp} seconds")


πŸ”„ Cache Management

If you want to clear the cached transcript:

from your_module_name import clear_cache

clear_cache("your_video.mp4")

πŸŽ₯ Demo

βœ… See it in action (link your video here):

πŸ‘‰ Watch Demo


πŸ‘€ Author

Md Shahriar Rahman Bhuiyan
🌐 LinkedIn Profile


πŸ’¬ Feedback

If you have feedback or want to collaborate, feel free to reach out via LinkedIn!

About

This script returns the the timestamp of a sentence from a user queries that was said in a video

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published