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 | 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. |
||||||
| 4 | ## ๐ What the Hell Is This? |
|||||||
| 5 | 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. |
|||||||
| 6 | You get: |
|||||||
| 7 | ๐ง smart content + ๐ฎ mindless gameplay = โ
actual retention (probably) |
|||||||
|
8 | ## ๐ธ Screenshot |
||||||
|
9 |  |
||||||
| 10 |  |
|||||||
| 11 |  |
|||||||
| 12 |  |
|||||||
| 13 |  |
|||||||
|
14 |  |
||||||
|
15 | ## ๐ฏ Oh Hell Yeah, Features |
||||||
| 16 | - Converts your average web article into a **Subway Surfers-screaming-TikTok-style video** |
|||||||
| 17 | - Rips text straight from URLs |
|||||||
| 18 | - Slaps it on top of fast-ass gameplay |
|||||||
| 19 | - Bonus points: **speech-to-text powered by Vosk API** |
|||||||
| 20 | - Built with **Flask + OpenCV + goose3 + Python + zero chill** |
|||||||
| 21 | --- |
|||||||
| 22 | ## ๐ณ Running This Beast with Docker |
|||||||
|
23 | **Step 1:** Pull the image, because we're not building this crap from scratch: |
||||||
|
24 | ```sh |
||||||
| 25 | docker pull tebwritescode/subwaysurfers-text20:latest |
|||||||
| 26 | ``` |
|||||||
| 27 | **Step 2:** Get the Vosk brain model and unzip it: |
|||||||
| 28 | ```sh |
|||||||
| 29 | wget https://alphacephei.com/vosk/models/vosk-model-en-us-0.22.zip |
|||||||
| 30 | unzip vosk-model-en-us-0.22.zip -d ./ |
|||||||
| 31 | rm vosk-model-en-us-0.22.zip |
|||||||
| 32 | ``` |
|||||||
| 33 | **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. |
|||||||
|
34 | **Step 4:** Let's ride: |
||||||
|
35 | ```sh |
||||||
| 36 | docker run -d --name subwaysurfers-text \ |
|||||||
| 37 | -v ./subwaysurfers/sources:/app/sources \ |
|||||||
| 38 | -v ./subwaysurfers/vosk-model-en-us-0.22:/app/static/vosk-model-en-us-0.22 \ |
|||||||
| 39 | -p 5000:5000 \ |
|||||||
| 40 | tebwritescode/subwaysurfers-text20:latest |
|||||||
| 41 | ``` |
|||||||
| 42 | **Step 5:** Fire up your browser and hit: |
|||||||
| 43 | ``` |
|||||||
| 44 | http://localhost:5000 |
|||||||
| 45 | ``` |
|||||||
| 46 | Get ready to weep tears of productivity as your article runs across a CGI train track. |
|||||||
| 47 | --- |
|||||||
|
48 | ## ๐ง Environment Variables For Control Freaks |
||||||
| 49 | Want to make this thing dance to your tune? Here are the variables you can tweak: |
|||||||
| 50 | ||||||||
| 51 | ```sh |
|||||||
| 52 | # Path to the Vosk TTS model |
|||||||
| 53 | MODEL_PATH=static/vosk-model-en-us-0.22 |
|||||||
| 54 | ||||||||
| 55 | # Where your Subway Surfers gameplay videos live |
|||||||
| 56 | SOURCE_VIDEO_DIR=sources |
|||||||
| 57 | ||||||||
| 58 | # Pick a random source video each time? |
|||||||
| 59 | # Set to "false" if you want to use a specific file (sources/myfile.mp4) |
|||||||
| 60 | RANDOM_SOURCE=true |
|||||||
| 61 | ||||||||
| 62 | # How fast do you want that narration? (Default: 1) |
|||||||
| 63 | # Higher = faster, lower = "I'm falling asleep here" |
|||||||
| 64 | DEFAULT_SPEED=1 |
|||||||
| 65 | ``` |
|||||||
| 66 | ||||||||
| 67 | Add them to your docker run command like a boss: |
|||||||
| 68 | ||||||||
| 69 | ```sh |
|||||||
| 70 | docker run -d --name subwaysurfers-text \ |
|||||||
| 71 | -e MODEL_PATH=static/custom-model \ |
|||||||
| 72 | -e RANDOM_SOURCE=false \ |
|||||||
| 73 | -e SOURCE_VIDEO_DIR=sources/myfile.mp4 \ |
|||||||
| 74 | -e DEFAULT_SPEED=1.5 \ |
|||||||
| 75 | -v ./subwaysurfers/sources:/app/sources \ |
|||||||
| 76 | -v ./subwaysurfers/vosk-model-en-us-0.22:/app/static/vosk-model-en-us-0.22 \ |
|||||||
| 77 | -p 5000:5000 \ |
|||||||
| 78 | tebwritescode/subwaysurfers-text20:latest |
|||||||
| 79 | ``` |
|||||||
|
80 | |||||||
|
81 | Or in your docker-compose like a champion: |
||||||
| 82 | ||||||||
| 83 | ```yaml |
|||||||
| 84 | services: |
|||||||
| 85 | subwaysurfers-text: |
|||||||
| 86 | image: tebwritescode/subwaysurfers-text20:latest |
|||||||
| 87 | environment: |
|||||||
| 88 | - MODEL_PATH=static/vosk-model-en-us-0.22 |
|||||||
| 89 | - SOURCE_VIDEO_DIR=sources |
|||||||
| 90 | - RANDOM_SOURCE=true |
|||||||
| 91 | - DEFAULT_SPEED=1.2 |
|||||||
| 92 | volumes: |
|||||||
| 93 | - <HOSTPATH>/sources:/app/sources |
|||||||
| 94 | - <HOSTPATH>/vosk-model-en-us-0.22:/app/static/vosk-model-en-us-0.22 |
|||||||
| 95 | ports: |
|||||||
| 96 | - "5000:5000" |
|||||||
| 97 | ``` |
|||||||
| 98 | --- |
|||||||
|
99 | ## ๐ Using Docker Compose Like a True King ๐ |
||||||
|
100 | Replace `<HOSTPATH>` with the full path to where your god-tier video and Vosk model live. |
||||||
| 101 | ```yaml |
|||||||
| 102 | services: |
|||||||
| 103 | subwaysurfers-text: |
|||||||
| 104 | image: tebwritescode/subwaysurfers-text20:latest |
|||||||
| 105 | volumes: |
|||||||
| 106 | - <HOSTPATH>/sources:/app/sources |
|||||||
| 107 | - <HOSTPATH>/vosk-model-en-us-0.22:/app/static/vosk-model-en-us-0.22 |
|||||||
| 108 | ports: |
|||||||
| 109 | - "5000:5000" |
|||||||
| 110 | ``` |
|||||||
| 111 | Start it up: |
|||||||
| 112 | ```sh |
|||||||
| 113 | docker-compose up -d |
|||||||
| 114 | ``` |
|||||||
| 115 | 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. ๐ฒ |
|||||||
| 116 | --- |
|||||||
| 117 | ## ๐ The Dockerfile Straight-Up Breakdown |
|||||||
| 118 | - Uses a slimmed-down official Python image |
|||||||
| 119 | - Installs all the nasty dependencies (yes, even ffmpeg and build tools) |
|||||||
| 120 | - Brings in Homebrew in case you're feeling fancy |
|||||||
| 121 | - Copies the app, installs Python and brew packages |
|||||||
| 122 | - Runs Flask like it means it |
|||||||
| 123 | - Your container, your rules |
|||||||
| 124 | --- |
|||||||
| 125 | ## ๐ฎ Shit I Still Wanna Add |
|||||||
| 126 | - Drop-down to select different AI voices (because not every AI wants to sound like Siri on Ambien) |
|||||||
|
127 | - ~NVIDIA GPU acceleration (because some of you have beefy rigs)~ Nixed this shit, GPU transcoding is slow AF |
||||||
| 128 | - ~Fix that annoying subtitle-stuck bug nobody asked for~ I think I squashed this fucker |
|||||||
|
129 | --- |
||||||
| 130 | ## ๐ง Want to Run It Without Docker? |
|||||||
|
131 | You rebel. Here's the repo for bare-metal installs: |
||||||
|
132 | ๐ https://github.com/tebwritescode/subwaysurfers-text-multi |
||||||
| 133 | --- |
|||||||
| 134 | ## ๐ Big-Ass Credit Section |
|||||||
| 135 | 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. |
|||||||
| 136 | --- |
|||||||
| 137 | ## โ ๏ธ Final Note from His Royal Freshnessโข |
|||||||
| 138 | 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. |
|||||||
| 139 | Enjoy learning like a hyper-caffeinated teenager on TikTok ๐ |
|||||||