This guide will help you get started with the Video RAG demo using Google's Gemini API.
# Clone or navigate to the video-rag-gemini directory
cd video-rag-gemini
# Install dependencies
pip install -r requirements.txt
# Test your setup
python test_setup.py- Visit Google AI Studio
- Sign in with your Google account
- Click "Create API Key"
- Copy your API key
Option A: Environment Variable (Recommended)
# Create .env file
cp .env.example .env
# Edit .env file and add your API key
GEMINI_API_KEY=your_actual_api_key_hereOption B: Enter in App
- You can also enter the API key directly in the Streamlit sidebar
streamlit run app.pyThe app will open in your browser at http://localhost:8501
- If you haven't set up the environment variable, enter your Gemini API key in the sidebar
- The key is masked for security
- Click "Choose a video file" in the sidebar
- Supported formats: MP4, AVI, MOV, MKV, WEBM
- File size limit: ~100MB (larger files may fail)
- Wait for the video to be processed (this can take several minutes)
- Once processing is complete, you'll see example questions
- Click on example questions or type your own
- Ask anything about the video content!
- "What is happening in this video?"
- "Summarize the main events"
- "Describe the overall scene"
- "Who are the people in this video?"
- "What objects can you see?"
- "Describe the clothing or appearance of people"
- "What actions are taking place?"
- "What is the sequence of events?"
- "What happens at the beginning/middle/end?"
- "What is the setting or location?"
- "Describe the environment"
- "What time of day is it?"
- "What colors are prominent in the video?"
- "What sounds might be present?" (Note: Gemini analyzes visual content)
- "What emotions are expressed?"
- Use clear, well-lit videos
- Avoid very shaky or blurry footage
- Higher resolution generally works better
- Be specific in your questions
- Ask about visual elements (Gemini can't hear audio)
- Break complex questions into simpler parts
- Keep video files under 100MB when possible
- Use common formats (MP4 is most reliable)
- Compress large files if needed
"Error uploading video"
- Check file format and size
- Ensure stable internet connection
- Try a different video file
"Video processing failed"
- File may be too large or corrupted
- Try compressing the video
- Check if format is supported
"Error generating response"
- API key may be invalid or expired
- Check your API quota/billing
- Try a simpler question first
App is slow or unresponsive
- Large videos take time to process
- Wait a few minutes before trying again
- Refresh the page if needed
- Check Setup: Run
python test_setup.py - Verify API Key: Make sure it's correct and has quota
- Test with Small Video: Try a short, small video first
- Check Logs: Look at the Streamlit terminal for error messages
# Run the command-line demo
python demo.py# Set API key for session
export GEMINI_API_KEY=your_key_here
# Run app
streamlit run app.pyYou can modify app.py to:
- Change the Gemini model (e.g., gemini-1.5-flash for faster responses)
- Adjust file size limits
- Customize the UI theme
- Add additional video formats
- Free Tier: Limited requests per minute/day
- File Size: ~100MB per file
- Processing Time: Varies by video length and complexity
- Rate Limits: May need to wait between requests
Check Gemini API pricing for current limits and costs.
- Never share your API key publicly
- Use environment variables for production
- The app doesn't store videos permanently
- Videos are uploaded to Google's servers for processing
Happy video chatting! 🎬✨