Blame
|
1 | # ๐ Subway Surfers Text-to-Video Converter |
||||||
| 2 | Skip the fairy-tale, just give me the code already --> [Click Here](https://teb.codes/2-Code/Docker/Subway-Surfers#using-docker-compose-like-a-true-king) |
|||||||
|
3 | |||||||
|
4 | Inspired by the absolute legend [danielbonkowsky/subwaysurfers-text](https://github.com/danielbonkowsky/subwaysurfers-text), this project throws some sauce on the original concept. If this container saves you time (or your sanity), go drop a star on his project already, damn it. |
||||||
| 5 | ## ๐ What the Hell Is This? |
|||||||
| 6 | You ever try to focus on an article and your brain taps out after the second paragraph? Same. This little monster extracts text from a webpage and slaps it onto hyperactive **Subway Surfers** gameplay footageโturning dry, boring content into something your scrolling-addicted brain can actually sit through. Perfect for TikTok, ADHD, or just making studying suck less. |
|||||||
| 7 | You get: |
|||||||
| 8 | ๐ง smart content + ๐ฎ mindless gameplay = โ
actual retention (probably) |
|||||||
|
9 | ## ๐ธ Screenshot |
||||||
|
10 |  |
||||||
| 11 |  |
|||||||
| 12 |  |
|||||||
| 13 |  |
|||||||
| 14 |  |
|||||||
|
15 |  |
||||||
|
16 | ## ๐ฏ Oh Hell Yeah, Features |
||||||
| 17 | - Converts your average web article into a **Subway Surfers-screaming-TikTok-style video** |
|||||||
| 18 | - Rips text straight from URLs |
|||||||
| 19 | - Slaps it on top of fast-ass gameplay |
|||||||
| 20 | - Bonus points: **speech-to-text powered by Vosk API** |
|||||||
| 21 | - Built with **Flask + OpenCV + goose3 + Python + zero chill** |
|||||||
| 22 | --- |
|||||||
| 23 | ## ๐ณ Running This Beast with Docker |
|||||||
|
24 | **Step 1:** Pull the image, because we're not building this crap from scratch: |
||||||
|
25 | ```sh |
||||||
| 26 | docker pull tebwritescode/subwaysurfers-text20:latest |
|||||||
| 27 | ``` |
|||||||
| 28 | **Step 2:** Get the Vosk brain model and unzip it: |
|||||||
| 29 | ```sh |
|||||||
| 30 | wget https://alphacephei.com/vosk/models/vosk-model-en-us-0.22.zip |
|||||||
| 31 | unzip vosk-model-en-us-0.22.zip -d ./ |
|||||||
| 32 | rm vosk-model-en-us-0.22.zip |
|||||||
| 33 | ``` |
|||||||
| 34 | **Step 3:** Drop a gameplay video into `./sources` โ any `.mp4` will do. More videos = more fun. Only one? It'll reuse that sucker on every run. |
|||||||
|
35 | **Step 4:** Let's ride: |
||||||
|
36 | ```sh |
||||||
| 37 | docker run -d --name subwaysurfers-text \ |
|||||||
| 38 | -v ./subwaysurfers/sources:/app/sources \ |
|||||||
| 39 | -v ./subwaysurfers/vosk-model-en-us-0.22:/app/static/vosk-model-en-us-0.22 \ |
|||||||
| 40 | -p 5000:5000 \ |
|||||||
| 41 | tebwritescode/subwaysurfers-text20:latest |
|||||||
| 42 | ``` |
|||||||
| 43 | **Step 5:** Fire up your browser and hit: |
|||||||
| 44 | ``` |
|||||||
| 45 | http://localhost:5000 |
|||||||
| 46 | ``` |
|||||||
| 47 | Get ready to weep tears of productivity as your article runs across a CGI train track. |
|||||||
| 48 | --- |
|||||||
|
49 | ## ๐ง Environment Variables For Control Freaks |
||||||
| 50 | Want to make this thing dance to your tune? Here are the variables you can tweak: |
|||||||
| 51 | ||||||||
| 52 | ```sh |
|||||||
| 53 | # Path to the Vosk TTS model |
|||||||
| 54 | MODEL_PATH=static/vosk-model-en-us-0.22 |
|||||||
| 55 | ||||||||
| 56 | # Where your Subway Surfers gameplay videos live |
|||||||
| 57 | SOURCE_VIDEO_DIR=sources |
|||||||
| 58 | ||||||||
| 59 | # Pick a random source video each time? |
|||||||
| 60 | # Set to "false" if you want to use a specific file (sources/myfile.mp4) |
|||||||
| 61 | RANDOM_SOURCE=true |
|||||||
| 62 | ||||||||
| 63 | # How fast do you want that narration? (Default: 1) |
|||||||
| 64 | # Higher = faster, lower = "I'm falling asleep here" |
|||||||
| 65 | DEFAULT_SPEED=1 |
|||||||
| 66 | ``` |
|||||||
| 67 | ||||||||
| 68 | Add them to your docker run command like a boss: |
|||||||
| 69 | ||||||||
| 70 | ```sh |
|||||||
| 71 | docker run -d --name subwaysurfers-text \ |
|||||||
| 72 | -e MODEL_PATH=static/custom-model \ |
|||||||
| 73 | -e RANDOM_SOURCE=false \ |
|||||||
| 74 | -e SOURCE_VIDEO_DIR=sources/myfile.mp4 \ |
|||||||
| 75 | -e DEFAULT_SPEED=1.5 \ |
|||||||
| 76 | -v ./subwaysurfers/sources:/app/sources \ |
|||||||
| 77 | -v ./subwaysurfers/vosk-model-en-us-0.22:/app/static/vosk-model-en-us-0.22 \ |
|||||||
| 78 | -p 5000:5000 \ |
|||||||
| 79 | tebwritescode/subwaysurfers-text20:latest |
|||||||
| 80 | ``` |
|||||||
|
81 | |||||||
|
82 | Or in your docker-compose like a champion: |
||||||
| 83 | ||||||||
| 84 | ```yaml |
|||||||
| 85 | services: |
|||||||
| 86 | subwaysurfers-text: |
|||||||
| 87 | image: tebwritescode/subwaysurfers-text20:latest |
|||||||
| 88 | environment: |
|||||||
| 89 | - MODEL_PATH=static/vosk-model-en-us-0.22 |
|||||||
| 90 | - SOURCE_VIDEO_DIR=sources |
|||||||
| 91 | - RANDOM_SOURCE=true |
|||||||
| 92 | - DEFAULT_SPEED=1.2 |
|||||||
| 93 | volumes: |
|||||||
| 94 | - <HOSTPATH>/sources:/app/sources |
|||||||
| 95 | - <HOSTPATH>/vosk-model-en-us-0.22:/app/static/vosk-model-en-us-0.22 |
|||||||
| 96 | ports: |
|||||||
| 97 | - "5000:5000" |
|||||||
| 98 | ``` |
|||||||
| 99 | --- |
|||||||
|
100 | ## ๐ Using Docker Compose Like a True King ๐ |
||||||
|
101 | Replace `<HOSTPATH>` with the full path to where your god-tier video and Vosk model live. |
||||||
| 102 | ```yaml |
|||||||
| 103 | services: |
|||||||
| 104 | subwaysurfers-text: |
|||||||
| 105 | image: tebwritescode/subwaysurfers-text20:latest |
|||||||
| 106 | volumes: |
|||||||
| 107 | - <HOSTPATH>/sources:/app/sources |
|||||||
| 108 | - <HOSTPATH>/vosk-model-en-us-0.22:/app/static/vosk-model-en-us-0.22 |
|||||||
| 109 | ports: |
|||||||
| 110 | - "5000:5000" |
|||||||
| 111 | ``` |
|||||||
| 112 | Start it up: |
|||||||
| 113 | ```sh |
|||||||
| 114 | docker-compose up -d |
|||||||
| 115 | ``` |
|||||||
| 116 | Fun fact: if you only mount one `.mp4`, the app will always use that. Mount a folder of them? It picks a random vid each time. ๐ฒ |
|||||||
| 117 | --- |
|||||||
| 118 | ## ๐ The Dockerfile Straight-Up Breakdown |
|||||||
| 119 | - Uses a slimmed-down official Python image |
|||||||
| 120 | - Installs all the nasty dependencies (yes, even ffmpeg and build tools) |
|||||||
| 121 | - Brings in Homebrew in case you're feeling fancy |
|||||||
| 122 | - Copies the app, installs Python and brew packages |
|||||||
| 123 | - Runs Flask like it means it |
|||||||
| 124 | - Your container, your rules |
|||||||
| 125 | --- |
|||||||
| 126 | ## ๐ฎ Shit I Still Wanna Add |
|||||||
| 127 | - Drop-down to select different AI voices (because not every AI wants to sound like Siri on Ambien) |
|||||||
|
128 | - ~NVIDIA GPU acceleration (because some of you have beefy rigs)~ Nixed this shit, GPU transcoding is slow AF |
||||||
| 129 | - ~Fix that annoying subtitle-stuck bug nobody asked for~ I think I squashed this fucker |
|||||||
|
130 | --- |
||||||
| 131 | ## ๐ง Want to Run It Without Docker? |
|||||||
|
132 | You rebel. Here's the repo for bare-metal installs: |
||||||
|
133 | ๐ https://github.com/tebwritescode/subwaysurfers-text-multi |
||||||
| 134 | --- |
|||||||
| 135 | ## ๐ Big-Ass Credit Section |
|||||||
| 136 | Massive props to [danielbonkowsky](https://github.com/danielbonkowsky/subwaysurfers-text) for the core idea. This is just a remixed, Dockerized, slightly louder sibling. Go say thanks. |
|||||||
| 137 | --- |
|||||||
| 138 | ## โ ๏ธ Final Note from His Royal Freshnessโข |
|||||||
| 139 | Yeah, the container works. It does the job. But it's packing a little extra weight and could use a clean-up. If trimming containers gives you a tech boner, PRs are wide open. |
|||||||
| 140 | Enjoy learning like a hyper-caffeinated teenager on TikTok ๐ |
|||||||