Automated bot that generates viral vertical videos (9:16) for TikTok, Reels, and Shorts — powered by "Would you rather?" questions.
Originally built in 2024, revised and open-sourced in 2026.
For each video the bot:
- Selects a unique question from the database (no repeats)
- Downloads two relevant images via SerpApi
- Generates voiceover with ElevenLabs TTS
- Renders a 9:16 video with text, images, and synced audio
- Concatenates all videos into a single final file and cleans up
red-or-blue/
├── main.py
├── Audios/
│ └── elevenlabsTTS.py
├── videos/
│ ├── background_video_text.py
│ └── background_video_perc.py
├── image_creation/
│ └── image_api.py
├── questions/
│ ├── questions.py
│ ├── questions.json
│ └── used_questions.txt
└── fonts/
└── Kanit-Bold.ttf
git clone https://github.com/yourusername/red-or-blue.git
cd red-or-blue
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # add your API keysRequired assets (not included):
videos/background.mp4— background videoAudios/question.mp3,or.mp3,correct.mp3,clock.mp3— static audio filesfonts/Kanit-Bold.ttf— only for percentage mode
python main.pySet the number of videos to generate in main.py:
num_videos = 10To reset used questions:
echo '' > ./questions/used_questions.txt| Service | Purpose | Free tier |
|---|---|---|
| ElevenLabs | Text-to-speech | 10,000 chars/month |
| SerpApi | Image search | 100 searches/month |
Text mode (background_video_text.py) — shows both choices as text. One highlights in yellow at the end.
Percentage mode (background_video_perc.py) — shows random vote percentages (e.g. 63% vs 37%). To use it:
# in main.py
from videos import background_video_perc as background_videoAdd entries to questions/questions.json:
["Choice A", "Choice B", "image keyword A", "image keyword B"]- Python 3.8+
- ImageMagick —
brew install imagemagick - FFmpeg —
brew install ffmpeg
MIT — see LICENSE
If this project saved you time, consider buying me a coffee. ☕