Skip to content

Latest commit

Β 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ToonTalk 🎬 β€” Cartoon Characters Se Baat Karo!

World's #1 First Talk2Video with Voice Cloning Auto Character Generation !

Interactive AI Cartoon Companion for Kids β€” powered by VideoDB

ToonTalk lets children talk to their favourite cartoon characters. Upload any anime or cartoon episode β€” the system automatically figures out who's in it, clones their voice directly from the video, and when a kid asks a question the character answers back in their own cloned voice with a full anime-style banner sliding up over the paused video.

Works for any cartoon in any language Multilingual β€” Hindi dubs, English originals, whatever you upload.


πŸ† VideoDB Primitives Used

Feature API
Video ingestion coll.upload() / URL ingest
Scene understanding video.index_scenes(model_name="pro") β€” VLM describes every scene
Dialogue transcription video.index_spoken_words() β€” full semantic search index
Scene + dialogue search video.search(SearchType.semantic)
LLM (character routing + answer) coll.generate_text(prompt, model_name="pro")
Voice cloning coll.generate_voice() with OmniVoice + ref_audio
Character art generation coll.generate_image(prompt, aspect_ratio="3:4") β€” FLUX

✨ How It Works β€” Full Pipeline

Stage 1: Upload

User uploads cartoon episode (MP4 file or YouTube URL)
         ↓
VideoDB stores video β†’ returns video_id + stream_url
         ↓
Local metadata file created for this video

Stage 2: Processing (runs once per video, ~5-10 minutes)

Video title sent to LLM (VideoDB generate_text)
         ↓
LLM returns full cast: names, personalities, typical dialogue,
language (Hindi dub vs English original)
         ↓
video.index_scenes(model_name="pro")
β†’ VLM describes every scene: who's visible, emotions, action
         ↓
video.index_spoken_words()
β†’ Full dialogue indexed for semantic search
         ↓
Language confirmed: sample 10 dialogue lines,
count Devanagari vs ASCII β†’ hindi / english
         ↓
Speaker verification: each character's typical dialogue
searched in spoken word index with score threshold 0.45
β†’ Only confirmed speakers kept (prevents character bleed-in)
         ↓
Voice extraction: 10-15s clean audio clip per confirmed character
β†’ ffmpeg extracts + normalises β†’ saved as ref audio
         ↓
Video is READY

Stage 3: Kid Asks a Question

Kid watches video normally
         ↓
Presses "Character se Puchho" β†’ video PAUSES
         ↓
Types or speaks their question (Hindi or English)
         ↓
Backend pipeline (~3-5 seconds):

  1. Detect question language
     β†’ Devanagari script? β†’ Hindi
     β†’ Hinglish keywords (yaar, kya, toh, hai...)? β†’ Hindi
     β†’ Otherwise β†’ English

  2. Scene context at pause point (Β±5 seconds)
     β†’ VLM scene description: what's visible, who's there, emotions

  3. Which character?
     β†’ Keyword match first ("yagami", "shinchan", "doraemon"...)
     β†’ LLM fallback if ambiguous

  4. Dialogue context (Β±15 seconds)
     β†’ Semantic search: what was actually being said near pause

  5. Language-adaptive answer generation:
     β†’ Hindi video + Hindi question  β†’ Hinglish text (Latin script)
     β†’ Hindi video + English question β†’ English text
     β†’ English video                 β†’ English text
     β†’ Always first-person, scene-aware, under 25 words

  6. Answer text appears on screen instantly (~3-5s)
         ↓
  7. Background TTS (~2 seconds):
     β†’ Voxtral Mini TTS (Mistral) + extracted ref audio
     β†’ Zero-shot voice cloning: answer spoken in character's own voice
     β†’ Audio plays through anime banner
         ↓
  8. Character portrait:
     β†’ VideoDB Flux generates anime portrait from character description
     β†’ White background removed via canvas processing
     β†’ Character "floats" over the banner
     β†’ Cached β€” instant on future questions

Stage 4: The Banner

Anime-style banner slides up from bottom of video:
  β˜… CHARACTER NAME KA JAWAB!        ← top strip with name stamp
  ─────────────────────────────────  ← torn paper divider
  "Answer text types out..."         ← dialogue with typewriter effect
  β–Ά REPLAY    ●●●  γ€°γ€°γ€°γ€°γ€°γ€°     ← replay + waveform while playing

  Character portrait floats right    ← Flux-generated, white bg removed
  Lightning bolts, particles, aura   ← animated effects
         ↓
Kid taps "Phir Suno" to replay audio
Kid taps "Aur Puchho" for another question
Kid taps "Video Continue Karo" to resume

🧠 What Makes It Smart

Automatic Cast Detection

No manual tagging needed. The LLM reads the video title β†’ returns full cast with personalities and typical dialogue. "Death Note" β†’ Light Yagami, L, Misa Amane. "Shinchan Hindi" β†’ Shinchan, Misae, Hiroshi, Kazama...

No Character Bleed-In

Every character goes through speaker verification before being included. Semantic search on their actual dialogue lines with a score threshold β€” if Doraemon's lines don't appear in a Death Note video, he's not added.

Voice Cloned From the Video Itself

The system doesn't use generic TTS voices. It finds a clean 10-15 second clip of the character actually speaking in this specific episode and uses that as the reference for zero-shot voice cloning. The answer sounds like the character from this video.

Language-Aware Everywhere

  • Detects video language from actual spoken dialogue (not just title)
  • Detects question language from script + keywords
  • Adapts response text format accordingly
  • Audio always matches the video's language

Scene-Grounded Answers

The LLM sees exactly what was happening at the paused frame β€” who's visible, what emotion, what action, what was being said. Answers are specific to the moment, not generic character trivia.


πŸš€ Quick Start

Prerequisites

1. Setup

git clone https://github.com/your-username/toontalk.git
cd toontalk

# Copy and fill in your API keys
cp .env.example .env

.env keys needed:

VIDEO_DB_API_KEY=...     # Required β€” powers everything
GROQ_API_KEY=...         # Required β€” voice question transcription
MISTRAL_API_KEY=...      # Required β€” cloned voice TTS

2. Backend

cd backend

python -m venv venv
venv\Scripts\activate          # Windows
# source venv/bin/activate     # Mac/Linux

pip install -r requirements.txt
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
# β†’ http://localhost:8000

3. Frontend

cd frontend
npm install
npm run dev
# β†’ http://localhost:5173

4. Upload & Process a Video

  1. Open http://localhost:5173
  2. Click Upload Video β€” paste a YouTube URL or upload an MP4
  3. Enter the video title (include the show name, e.g. "Shinchan Hindi Episode")
  4. Click Process β€” watch the progress bar (~5-10 min first time)
  5. Once ready β†’ click the video β†’ pause β†’ ask anything!

πŸ“ Project Structure

toontalk/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ main.py                  # FastAPI β€” all API routes
β”‚   β”œβ”€β”€ videodb_service.py       # All VideoDB SDK operations
β”‚   β”œβ”€β”€ llm_service.py           # LLM calls + language detection + Whisper
β”‚   β”œβ”€β”€ character_config.py      # Character personas + answer prompt
β”‚   β”œβ”€β”€ voxtral_service.py       # Mistral TTS + spend tracking ($1 cap)
β”‚   β”œβ”€β”€ flux_service.py          # VideoDB Flux character image generation
β”‚   β”œβ”€β”€ sandbox_manager.py       # VideoDB sandbox lifecycle (singleton)
β”‚   β”œβ”€β”€ video_metadata/          # Per-video JSON (characters, voices, indexes)
β”‚   β”œβ”€β”€ ref_audio/               # Extracted character voice clips
β”‚   β”œβ”€β”€ tts_cache/               # Generated TTS audio files
β”‚   └── character_images/        # Flux-generated character portraits (cached)
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ App.jsx              # Main app β€” upload, library, player screens
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ VideoPlayer.jsx  # Video player + Q&A panel
β”‚   β”‚   β”‚   β”œβ”€β”€ CharacterPopup.jsx  # Anime banner overlay with all effects
β”‚   β”‚   β”‚   └── MicButton.jsx    # Voice recorder with waveform
β”‚   β”‚   └── services/api.js      # All backend API calls
β”‚   └── public/characters/       # Static character images (Shinchan, Misae, Hiroshi)
└── .env

🌐 API Reference

Endpoint Method Description
/api/upload POST Upload video file
/api/upload-url POST Upload from URL / YouTube
/api/process/{id} POST Start AI processing pipeline
/api/status/{job_id} GET SSE Real-time progress stream
/api/videos GET List all processed videos
/api/video/{id} GET Video metadata + stream URL
/api/ask POST Text question β†’ character answer
/api/ask-voice POST Voice question β†’ character answer
/api/generate-tts POST Generate cloned voice audio
/api/character-image/{vid}/{char} GET Get/generate character portrait
/api/voxtral-usage GET TTS spend tracker
/api/sandbox-status GET VideoDB sandbox status

πŸ’‘ Supported Shows (Auto-detected)

Any show the LLM knows about works automatically β€” no manual setup. Tested with:

  • Shinchan (Hindi dub) β€” full family cast
  • Doraemon (Hindi dub)
  • Death Note (English)
  • Naruto (Hindi or English)
  • Dragon Ball Z
  • Any cartoon β€” generic character fallback if show is unknown

πŸ’° API Cost Estimate

Task Approx Cost
Process one episode (scene + spoken word index) ~$0.50-2.00 VideoDB credits
Voice extraction per character negligible
Answer text (LLM) per question ~$0.001
TTS per answer (~120 chars) ~$0.002 Mistral
Flux character portrait (generated once, cached) ~$0.01 VideoDB credits
1000 questions on a processed video ~$2.00 total

πŸ“ One-Line Pitch

"Pause any cartoon, ask the character anything in Hindi or English β€” they answer back in their own voice, aware of exactly what was happening in the scene."


πŸ“œ License

MIT β€” Built for the VideoDB Hackathon 2026

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages