# 🎮 Subway Surfers Text-to-Video Generator
> Behold: a Flask-powered monstrosity that slaps together gameplay footage, TikTok voices, and on-point captions—giving your boring text the glow-up it never knew it needed.
![Version](https://img.shields.io/badge/Version-1.1.22-blue)
![Python](https://img.shields.io/badge/Python-3.12-green)
![Flask](https://img.shields.io/badge/Flask-3.0.3-blue)
![Docker](https://img.shields.io/badge/Docker-Ready-blue)
![License](https://img.shields.io/badge/License-MIT-yellow)

## ⚡ What the Heck Is This?
Turn your articles—or your random stream-of-consciousness into short-form crack. With Subway Surfers gameplay. Because apparently, our brains now need dopamine and parkour to learn a damn thing. This app makes it fast, fun, and freakishly effective. Get that sweet virality hit.

---

## 📸 Screenshots
<details>
  <summary><i>Click to show screenshots</i></summary>

![Generate](https://teb.codes/2-Code/Docker/Subway-Surfers/Screenshot_2025-07-12_at_5.17.25_PM.png)
![Link](https://teb.codes/2-Code/Docker/Subway-Surfers/Screenshot_2025-07-12_at_9.14.47_PM.png)
![Progress Bar](https://teb.codes/2-Code/Docker/Subway-Surfers/Screenshot_2025-07-12_at_9.11.06_PM.png)
![View Current 1](https://teb.codes/2-Code/Docker/Subway-Surfers/Screenshot_2025-07-12_at_9.12.03_PM.png)
![View Current 2](https://teb.codes/2-Code/Docker/Subway-Surfers/Screenshot_2025-07-12_at_5.17.41_PM.png)
![Browse](https://teb.codes/2-Code/Docker/Subway-Surfers/Screenshot_2025-07-12_at_9.29.02_PM.png)

</details>

## 🆕 Version 1.1.22 — We’re Not in Beta Anymore, Baby
🏁 It’s production-ready, polished, and packs some serious features:
- ✅ WhisperASR joins the party for laser-accurate captions
- ✅ Will chew through long text like a pro—no irritating cutoffs
- ✅ Fine-tuned caption timing for when milliseconds matter
- ✅ Docker build now squeaky clean and snappy
- ✅ Wiped all temps and test outputs—Marie Kondo would be proud

### 🚀 Previously on "Holy Hell, This App Got Stuff"
- ✅ Watch your video generate in real time like it's 1999
- ✅ Choose your favorite TikTok voice—Brian or bust
- ✅ Browse your masterpieces in-app like a proper social media producer
- ✅ Survives crashes like a cockroach in an apocalypse

📜 Wanna see the full changelog? It’s hanging out in [version.py](https://github.com/tebwritescode/subwaysurfers-text-multi/blob/b79b35ce12dd8bfb1e1ba567e3dd57e2dba17da9/version.py).

---

## ✨ Magical Powers (aka Features)
### 🎬 Video Generation Wizardry
- Scrape the useful text from pages or input it directly
- Narration via TikTok’s vocal besties
- Subtitles locked in like clockwork—with tweakable timing
- Auto-looping gameplay on repeat while your message goes viral
- See every glorious progress bar along the way

### 🎙️ Text-To-Speech Goodness
- TikTok voices so real, it’s uncanny
- Plays nice with long texts, even War and Peace levels
- Strip-clean text for pronunciation perfection
- Adjustable speed so you can go Morgan Freeman slow or auctioneer fast

### 📱 Sleek, Sexy UI
- Modern, mobile-ready, and not hideous to look at
- Watch your progress *actually* progress
- Full-on video manager and preview
- Flash messages for feedback, because silence is for losers

### 🔧 Under-the-Hood Insanity
- WhisperASR makes sure your captions don’t miss a beat
- Dockerified for painless deployment
- Configuration heaven (caption offsets, model paths, the works)
- Doesn’t crash when life gives you lemons

---

## 🚀 Quickstart: Make It Go Brrr
### 🧙 You Will Need
- Python 3.12+ and pip (no dinosaurs allowed)
- FFmpeg (the secret sauce)
- OR Docker (the easy button)

### Installation Path #1: Docker All the Damn Way (Recommended)
```bash
docker run -p 5000:5000 \
  -e WHISPER_ASR_URL=http://your-whisper-server:9000 \
  -v /path/to/videos:/app/static \
  tebwritescode/subwaysurfers-text20:latest
```

Or slap it up with Docker Compose:
```bash
docker-compose up -d
```

### Installation Path #2: Do It Yourself, You Brave Nerd
```bash
git clone https://github.com/tebwritescode/subwaysurfers-text-multi.git
cd subwaysurfers-text-multi
python3.12 -m venv .venv
source ./.venv/bin/activate
pip install -r requirements-pip.txt
```

Now for the secret ingredients:
- 👂 Get the Vosk model:  
  https://alphacephei.com/vosk/models/vosk-model-en-us-0.22.zip  
  Unzip that sucker into `./static/vosk-model-en-us-0.22/`
- 🎮 Add background gameplay to `./static/` (grab a sample:  
  https://drive.google.com/file/d/1ZyFZKIB1HiZM_XDQPRRiiAIvU4sgl10k/view)

Fire. It. Up:
```bash
python app.py
# Or the Flask way
flask run
```

Then slide into `http://localhost:5000` and get generating.

---

## 🛠️ Tweaky Settings (Because You’re Fancy)
| Name | Default | What It Does |
|------|---------|---------------|
| `FLASK_PORT` | 5000 | Port for your web wizardry |
| `WHISPER_ASR_URL` | http://localhost:9000 | Caption whisperer’s URL |
| `CAPTION_TIMING_OFFSET` | 0.25 | Controls how early/late your captions appear |
| `SOURCE_VIDEO_DIR` | ./static | Folder where your gaming chaos lives |
| `MODEL_PATH` | ./static/vosk-model-en-us-0.22 | Location of Vosk’s big brain |
| `DOCKER_ENV` | false | Flip to true when running in a container |

Quick Docker deploy reminder:
```bash
docker run -p 5000:5000 \
  -e WHISPER_ASR_URL=http://your-whisper-server:9000 \
  -e CAPTION_TIMING_OFFSET=-0.1 \
  -v /path/to/videos:/app/static \
  tebwritescode/subwaysurfers-text20:latest
```

---

## 📖 How to Wield the Power
### Generate a Video, Baby
1. Stroll over to the homepage
2. Drop in your favorite copy-pasta, or slap in a URL
3. Pick a voice (Jessie? Brian? Stitch? Go wild.)
4. Adjust speech speed if you’re feeling fancy
5. Click “Generate” and watch the sausage being made
6. Download or stream the glorious final product

### Voices You’ll Love or Hate
- Jessie — sassy, spunky, sounds like TikTok
- Brian — Very British. Probably drinks earl grey.
- Stitch — You already know he’s up to something.
- Echo — Narrates your life like it’s a gritty documentary.
- Oh, and more. Because OF COURSE there are more.

### Hand-Picked Gameplay Backgrounds (aka: dopamine fuel)
- Subway Surfers
- Minecraft parkour (aka sweaty palms)
- Pokémon
- Factorio (factory go brrr)
- StarCraft battles
- Oddly satisfying slice clips

---

## 🏗️ How It All Stacks
```
subwaysurfers-text-multi/
├── app.py                # Flask brainstem
├── sub.py                # Turns text into magic
├── tiktokvoice.py        # Talks like TikTok
├── whisper_timestamper.py # Whisper those timestamps
├── videomaker.py         # Mashes video + captions
├── cleantext.py          # Makes your input less gross
├── version.py            # Keeps track of app’s many glow-ups
├── requirements-pip.txt   # Stuff Python needs
├── requirements-docker.txt # Stuff Docker needs
├── Dockerfile            # Bottle it up
├── docker-compose.yml    # Auto-magic orchestration
├── templates/            # HTML for humans
├── static/               # Game videos and models
└── final_videos/         # Birthplace of brilliance
```

💻 Tech Stack:
- Backend: Python 3.12, Flask
- TTS: Our buddy TikTok
- Speech: Vosk + Whisperlore
- Video: MoviePy, FFmpeg, OpenCV madness
- Frontend: HTML/CSS/JS that doesn’t suck
- Container: Yeah, Docker is here too

---

## 🔐 Don’t Worry, It’s Not Sketchy
- Input gets sanitized so trolls don’t win
- Malicious URLs? Denied at the gate
- Files renamed so they don’t nuke your machine
- Docker gives it adult supervision
- No login required—public chaos only

---

## 🛠️ For the Code-Wranglers
### Test Everything Before You Wreck Everything
```bash
python app.py --test
./clean.sh  # Delete past masterpieces
./concat.sh # Process like a content farm
```

### Build the Docker Unicorn
```bash
docker buildx build --platform linux/amd64,linux/arm64 \
  -t tebwritescode/subwaysurfers-text20:latest \
  -t tebwritescode/subwaysurfers-text20:v1.1.22 \
  --push .
```

---

## 🐞 Known Bugs (We Keep It Real)
- Big videos = big wait times. Queue a snack.
- Weird characters might bamboozle the TTS
- Long articles can piss off your browser—keep it snack-sized
- WhisperASR server required if you actually want captions to line up

---

## 📊 Performance Stats
- 2-5 minutes per minute of final vid
- Eats up to 10,000 words like a champ
- Optimized for videos under 10 mins
- Section-splits large rants for smoother sailing

---

## 🛣️ Roadmap (aka what’s cookin’)
- [ ] Delegate video crunching to its own nerdy container
- [ ] Let users pick their gameplay drug of choice
- [ ] Upload your own gameplay, you control freak
- [ ] More voice options (maybe Darth Vader?)
- [ ] Sneak peeks as the sausage gets stuffed
- [ ] Mass-processing for the content addicted

---

## 🤝 Wanna Contribute? We Like You Already
1. Fork it like it’s hot
2. Branch out: `git checkout -b feature/amazing-feature`
3. Test until it breaks
4. Push your magic: `git push origin feature/amazing-feature`
5. Make that Pull Request and show us what you got

---

## 📝 License Stuff
MIT License. You’re free to do most things, just don’t sue us.

---

👑 Made with caffeine, chaos, and code by [tebbydog0605](https://github.com/tebbydog0605)  
📦 Docker Hub: [tebwritescode](https://hub.docker.com/u/tebwritescode)  
🌐 Website: [teb.codes](https://teb.codes)
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9