Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Kamal-Nayan-Kumar/AI-Video-Gen/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheScriptGenerator class creates natural-sounding voice narration scripts for each slide. It takes the content structure from ContentGenerator and produces timed narration text that matches the specified language and tone.
Class Definition
Constructor
- Model: Uses
Config.GEMINI_MODEL - Response Format: JSON (
application/jsonMIME type) - API Key: Configured via
Config.GEMINI_API_KEY
Methods
generate_scripts
Generates voice narration scripts with timestamps for all slides.The presentation content structure from
ContentGeneratorLanguage for narration. Supported:
english, hindi, kannada, telugu, tamil, bengali, gujarati, malayalam, marathi, odia, punjabiNarration tone style:
formal: Academic, precise, technical languagecasual: Friendly, conversational, easy to understandstorytelling: Narrative style with stories and examples
Script data with narration text and timestamps for each slide
The presentation topic
Total video duration in seconds (sum of all slide durations)
Language code for the narration
Array of slide script objects with narration and timing
Data Models
SlideScript
Pydantic model for individual slide narration.VideoScript
Pydantic model for complete video script.Narration Guidelines
The script generator follows specific rules for different slide types:For Animation Slides
Narration must describe what the viewer sees happening in the animation.
- “As you can see…”
- “Watch as…”
- “Notice how…”
- “Observe that…”
For Image Slides
Reference the image naturally:For Text-Only Slides
Focus on explaining the concept clearly without visual references:Tone Configuration
Frombackend/generators/script_generator.py:35-39:
Usage Example
Frombackend/app.py:246-249:
Timestamp Synchronization
Initial timestamps are estimates. They are corrected after audio generation based on actual audio durations:Prompt Engineering
The generator builds a detailed prompt including:- Topic and settings: Language, tone, and instructions
- Slide information: Title, content, duration, and visual flags
- Narration requirements: Pacing (~150 words/minute), natural speech
- Animation-specific instructions: Describe visual elements step-by-step
- Timing guidance: Sequential timestamps matching slide durations
File Persistence
Generated scripts are automatically saved to:Response Processing
The generator cleans markdown formatting from AI responses:Related Components
- ContentGenerator - Provides input content structure
- VoiceGenerator - Converts narration text to audio
- VideoComposer - Uses timestamps for video synchronization