README.md
  1  # Video Caption Generator
  2  
  3  Automatically transcribe short-form videos from Google Drive, deduplicate by content, and generate social media captions + YouTube/Facebook titles using AI.
  4  
  5  ## What It Does
  6  
  7  1. **Scans** a Google Drive folder for new video files (MP4, MOV, etc.)
  8  2. **Transcribes** each video locally using OpenAI Whisper
  9  3. **Deduplicates** โ€” detects A/B variants (same audio, different on-screen titles) and processes them all with proper tagging
 10  4. **Generates** a social media caption and a YouTube/Facebook title for each clip using Claude API
 11  5. **Tracks** processed video IDs so re-runs skip already-seen files
 12  
 13  ## Example Output
 14  
 15  ```
 16  *my-video-clip.mp4*
 17  ๐Ÿ“ Transcript: The biggest mistake people make with paid ads is not testing creative fast enough...
 18  ๐ŸŽฌ Caption: Most people blow their ad budget because they test one creative at a time. Run 5-10 variants in the first week โ€” kill losers fast, scale winners hard. Speed beats perfection every time.
 19  ๐Ÿ“บ YT/FB Title: Why 90% of Ad Budgets Get Wasted
 20  ```
 21  
 22  For A/B variants (same transcript, different filename):
 23  
 24  ```
 25  *my-clip(1).mp4* (A/B variant of my-clip.mp4)
 26  ๐Ÿ“ Transcript: The biggest mistake people make with paid ads...
 27  ๐ŸŽฌ Caption: ...
 28  ๐Ÿ“บ YT/FB Title: The Ad Mistake That Burns Your Budget
 29  ```
 30  
 31  ## Prerequisites
 32  
 33  - **Python 3.10+**
 34  - **OpenAI Whisper** installed locally (`pip install openai-whisper` or via Homebrew)
 35  - **Google Drive API access** via a CLI tool that can list and download files (the script uses `gws-gateway.sh` by default โ€” adapt the `gws()` function to your Drive CLI or SDK)
 36  - **Anthropic API key** for caption/title generation
 37  
 38  ## Setup
 39  
 40  1. Install dependencies:
 41  
 42  ```bash
 43  pip install -r requirements.txt
 44  ```
 45  
 46  2. Install Whisper (if not already):
 47  
 48  ```bash
 49  pip install openai-whisper
 50  # or on macOS:
 51  brew install whisper
 52  ```
 53  
 54  3. Set your Anthropic API key:
 55  
 56  ```bash
 57  export ANTHROPIC_API_KEY="your-key-here"
 58  ```
 59  
 60  4. Configure your Google Drive CLI path in `scripts/process_videos.py` (see the `GWS_GATEWAY` variable).
 61  
 62  ## Usage
 63  
 64  ```bash
 65  python3 scripts/process_videos.py --folder-id YOUR_FOLDER_ID
 66  ```
 67  
 68  ### Options
 69  
 70  | Flag | Default | Description |
 71  |------|---------|-------------|
 72  | `--folder-id` | *(required)* | Google Drive folder ID to scan for videos |
 73  | `--processed-log` | `processed_ids.json` | Path to JSON file tracking already-processed video IDs |
 74  
 75  ### Multiple Folders
 76  
 77  Run against different folders โ€” they share the same `processed_ids.json` since Drive file IDs are globally unique:
 78  
 79  ```bash
 80  python3 scripts/process_videos.py --folder-id YOUR_MAIN_FOLDER_ID
 81  python3 scripts/process_videos.py --folder-id YOUR_AB_FOLDER_ID
 82  ```
 83  
 84  ## Caption & Title Style Guide
 85  
 86  - **Caption:** First person, conversational, no hashtags, 2-4 sentences. Hook first, insight second.
 87  - **Title:** Curiosity-driven, under 60 chars, no clickbait. Lead with tension or a number.
 88  
 89  ## Customization
 90  
 91  - Edit the prompt in `generate_caption_and_title()` to match your brand voice
 92  - Swap `claude-sonnet-4-6` for another model in the API call
 93  - Replace the `gws()` function with your own Google Drive SDK integration
 94  - Add a `log_to_sheet()` implementation to track results in a Google Sheet
 95  
 96  ## How It Works
 97  
 98  ```
 99  Google Drive Folder
100          โ”‚
101          โ–ผ
102    List new videos (skip already-processed IDs)
103          โ”‚
104          โ–ผ
105    Download each โ†’ temp directory
106          โ”‚
107          โ–ผ
108    Whisper transcription (local, model: turbo)
109          โ”‚
110          โ–ผ
111    Content hash for dedup (detect A/B variants)
112          โ”‚
113          โ–ผ
114    Claude API โ†’ caption + title per clip
115          โ”‚
116          โ–ผ
117    Output formatted results + save processed IDs
118  ```
119  
120  ## License
121  
122  MIT
123  
124  
125  ---
126  
127  <div align="center">
128  
129  **๐Ÿง  [Want these built and managed for you? โ†’](https://singlebrain.com/?utm_source=github&utm_medium=skill_repo&utm_campaign=ai_marketing_skills)**
130  
131  *This is how we build agents at [Single Brain](https://singlebrain.com/?utm_source=github&utm_medium=skill_repo&utm_campaign=ai_marketing_skills) for our clients.*
132  
133  [Single Grain](https://www.singlegrain.com/?utm_source=github&utm_medium=skill_repo&utm_campaign=ai_marketing_skills) ยท our marketing agency
134  
135  ๐Ÿ“ฌ **[Level up your marketing with 14,000+ marketers and founders โ†’](https://levelingup.beehiiv.com/subscribe)** *(free)*
136  
137  </div>