Skip to content

learnwithparam/video-rag-faiss

Repository files navigation

Video QA with Transcript Search and Timestamp Citations

learnwithparam.com

Chat with any YouTube video. Fetch the transcript, index it with FAISS + BM25 hybrid search, and answer questions grounded in what was actually said, with clickable timestamp links back to the exact moment in the video.

Start learning at learnwithparam.com. Regional pricing available with discounts of up to 60%.

What You'll Learn

  • Pull YouTube transcripts and metadata without scraping the page
  • Chunk transcripts in timestamped segments so citations stay accurate
  • Build a hybrid retriever that fuses FAISS semantic search with BM25 keyword search
  • Use reciprocal rank fusion to combine the two ranked lists
  • Ground LLM answers in retrieved chunks and render timestamp-linked citations
  • Ship a Streamlit UI with embedded video playback next to the chat panel

Tech Stack

  • Python 3.10+ with uv for dependency management
  • Streamlit for the two-panel video + chat UI
  • youtube-transcript-api for transcript fetching
  • FAISS for semantic retrieval + rank-bm25 for keyword retrieval
  • OpenAI for embeddings and chat completions

Getting Started

Prerequisites

  • Python 3.10+
  • uv (installed automatically by make setup)
  • An OpenAI API key

Quick Start

make dev

# Or step by step:
make setup
# Edit .env with your OPENAI_API_KEY
make run

Open http://localhost:8501, paste a YouTube URL, and ask questions.

With Docker

make build
make up
make logs
make down

Challenges

Work through these incrementally to build the app:

  1. Transcript Fetch - Parse a YouTube URL and pull the transcript with timestamps
  2. Metadata - Fetch title, thumbnail, and channel info for preview
  3. Chunking - Split the transcript into overlapping time-windowed chunks
  4. Semantic Index - Embed chunks with OpenAI and store them in FAISS
  5. Keyword Index - Build a BM25 index over the same chunks
  6. Hybrid Retrieval - Fuse FAISS and BM25 results with reciprocal rank fusion
  7. Grounded Chat - Prompt the LLM with retrieved chunks and render timestamped citations
  8. Multi-Video UI - Let the user switch between indexed videos in one Streamlit session

Makefile Targets

make help           Show all available commands
make setup          Initial setup (create .env, install deps)
make dev            Setup and run (one command!)
make run            Run the Streamlit app
make build          Build Docker image
make up             Start container
make down           Stop container
make clean          Remove venv and caches

Learn more

About

Video QA with Transcript Search and Timestamp Citations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors