1.7 KiB
1.7 KiB
Subtitle Extraction Investigation
Overview
This script compares different methods and granularity levels for subtitle extraction from video files.
Installation Requirements
FFmpeg (Required for Audio Extraction)
Windows:
- Download from: https://ffmpeg.org/download.html
- Or use winget:
winget install ffmpeg - Or use chocolatey:
choco install ffmpeg
After installation, restart your terminal and verify:
ffmpeg -version
Features
Granularity Levels
- Movie-level: Entire video summary + full transcript
- Second-level: Time-stamped subtitles by phrase/sentence (MM:SS.mmm)
- Word-level: Individual word timestamps
Comparison Methods
- Method A: Upload video directly to Gemini
- Method B: Extract audio with ffmpeg, then upload audio only
Results Analysis
Token Usage (from first run - video only):
- Movie-level: 15,618 tokens | 32s processing
- Second-level: 19,456 tokens | 96s processing
- Word-level: 40,279 tokens | 226s processing
Key Findings:
- Higher granularity = more tokens + longer processing
- Word-level is ~2.5x more expensive than movie-level
- Second-level provides good balance for subtitle generation
Usage
# Activate virtual environment
.\venv\Scripts\Activate.ps1
# Run investigation
python backend/investigate_subtitle_extraction.py
Output Files
assets/1_processed/subtitle_investigation/*.json- Individual comparison resultscomplete_comparison.json- Full comparison data with metadata
Next Steps
- Install ffmpeg to test Method B (audio extraction)
- Compare audio vs video method performance
- Determine optimal approach for production pipeline