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