A fixed route from "my game runs on the phone" to a trailer, shorts, a teaser, an end card and a thumbnail, in every language of your game. This way of working was used for the trailers and shorts of several mobile games. Every rule under "Learned" cost a round there.
The principle: nothing is edited by hand. Everything comes from a shot list and a few scripts. To change something, you change the list and run it again; you never open a video editor.
How to use this
This guide is written for you and for your agent (Claude Code, Codex or another).
- Put this file in the folder of your game, for example as
docs/PROMO-VIDEOS.md. - Tell your agent: "Read docs/PROMO-VIDEOS.md and make the promo videos of this game. Start with one clip."
- Look at what comes out and say what should change. The agent writes the scripts; you judge the picture.
Start small: record one clip, edit one short. Only when that is right, the rest.
What you get
| What | Format | Length | For |
|---|---|---|---|
| Trailer | 1920×1080, 60 fps | 45–65 s | YouTube, your site, the Play Store |
| Shorts (2 or 3) | 1080×1920, 60 fps | 15–25 s | YouTube Shorts, Reels, TikTok |
| Teaser | 1080×1920, 60 fps | 6 s | A hook without text, in two versions |
| End card | both formats, video and PNG | 7.5 s | To put under any other video |
| Thumbnail | 1280×720 | – | YouTube |
Every file exists in every language of your game, with the language in its name (-EN, -NL).
What you need
- Your game as a web game (HTML and JavaScript, for example with vite), and as an Android app
with a development build on a real phone. How to make that is in the guide Launch your Android
game. Without an Android phone you can record the picture in Chrome on the PC instead, at the
size of a phone (Playwright,
recordVideo). That picture is less sharp; for a trailer a real phone is better. - On the PC:
ffmpegandffprobeon the PATH, Node.js withplaywright-core, Google Chrome, Python withnumpyandPillow, andadb(Android platform-tools). - A picture of a phone with an empty black screen on a transparent background, for the trailer, the end card and the thumbnail. A render of your own, or one you may use.
- Sound of your own. The sounds and music of your game itself, and what you synthesise for it. Do not use music or footage you have no rights to.
How it works
Four scripts deliver four kinds of material, a fifth edits. Keep them together in tools/promo/ of
your game.
- The shot list (
clips.mjs). One list of clips, such ashero,title,solve,night. Each clip has a starting situation (level, seed) and steps[verb, argument]:wait,click,solve,pickLevel. The verbs live inrunner.mjs. The same list is played twice: on the phone for the picture, and in a browser for the sound. - The picture (
record-phone.mjs). The development build on the phone is driven over Chrome DevTools (adb forwardto the WebView), whileadb shell screenrecordrecords the screen, for example at 16 Mbit. Per clip: wake the device, start recording, clear the saved progress and set up the level (fresh), play the steps, stop recording and pull the file. The script writes a mark per step (milliseconds since the recording started) intotiming.json, checks the length of every file withffprobe, and records a failed clip again up to three times.timing.jsonis merged, not overwritten: recording one clip again leaves the rest intact. - The sound (
record-audio.mjs).screenrecordrecords no sound. So the same shot list runs once more in headless Chrome. A tap on the Web Audio graph (extendAudioNode.prototype.connect, so that everything that goes to the speakers also goes to aMediaStreamAudioDestinationNode) puts the sound into aMediaRecorder(webm/opus, 192 kbps). Keep recording for 4 seconds after the last step, or a sound ends too early. - The graphic layers (
render-cards.mjsandcards.html). Your dev server servescards.html, which draws one layer per?layer=: intro, background and foreground of the end card, text next to the phone (16:9), caption (9:16), thumbnail. The script turns them into PNGs per format (1080×1920, 1920×1080, 1280×720) and per language. Backgrounds are opaque; everything that goes over the picture has transparency. - The phone (
phone.py). Takes the frame, a mask of the screen and the four corners of the glass from the picture of the phone. With those,ffmpegprojects a recording into the glass in perspective; a camera cut-out stays open. - Sound of your own (
beat.py,sting.py). A soft pulse under the shorts and a sting under the exciting teaser, synthesised withnumpy. No licence comes with them. - The edit (
build.py). Per cut a list of segments. A segment is a clip, a mark with an offset (for example("solve:done", 0, -1.4): 1.4 seconds before the end of the first solve) and a length, plus the text that goes with it. Each segment is rendered on its own (x264, crf 18) and then joined with 0.6 s crossfades, in small groups (see "An ordinary laptop"). The whole is normalised to -14 LUFS, the standard of YouTube, with+faststart.
Preparing your game (once)
- A handle in the game. The scripts talk to the game through an object on
window, only in the development build if you like: the board, the world, the camera, and functions to choose a mood or a level.freshwrites the language and the starting situation intolocalStorageand reloads the page. - The same game on every run. Phone, tablet and sound run must play exactly the same game.
- A game with a fixed simulation step: drive it per step, not per frame. A hook that runs after every step puts the moves on the same step on the phone and in the browser.
- A game without a simulation clock, such as a match-3: plant a seed. A board that comes from a seed and a bot without chance play the same moves everywhere.
- Marks from the game itself. Let the game report every phase that is animated (a move, a
special piece, a finale), for example with an
onPhasehook. Cutting on "the third move" does not work: which move gives the effect, you only know afterwards. - Headless without drawing. A flag that skips drawing in the sound run. In headless Chrome without a graphics card, a game otherwise falls behind the clock.
- Texts and colour in
cards.html: per language a subtitle, a tagline, "Get it on Google Play" and two short lines per moment. At 1080 pixels wide, a heading of about 62 px is the most that fits on one line. - A
heroclip. The first level, solved calmly, the same as your store screenshots. The end card, the thumbnail and the teaser come from it.
Design rules
- The phone looks into the text, never away from it. Look at the picture of the phone before you choose the side: when the glass faces right, the phone stands on the left and the text on the right. Standing still; a floating phone distracts.
- 16:9 keeps the picture on the phone. A portrait recording with black bars in a wide frame reads as a mistake.
- 9:16 shows the picture at full height, with a blurred enlargement behind it and the text on a dark plate low in the frame. The plate keeps the text readable, on a dark level and a light one.
- The teaser has no text. Six seconds; a caption would still be coming in when the clip already stops. Make two versions with the same picture: a calm one and an exciting one, with only the sound changed.
- Music as one continuous bed, not per clip. Record the sound effects without music and lay one long take of the music under every cut. Music cut per clip jumps at every change.
- File names in the language of the cut, with
-ENor-NL. 60 fps, x264 crf 18, aac 192k.
Recording and building (per round)
In a terminal with bash (Git Bash on Windows):
adb shell monkey -p <package-name>.dev -c android.intent.category.LAUNCHER 1
adb forward tcp:9222 localabstract:webview_devtools_remote_$(adb shell pidof <package-name>.dev)
npx vite --port 4176 # one server, in a second terminal; stop it after the round
node tools/promo/record-phone.mjs # picture, all clips
node tools/promo/record-audio.mjs # sound, all clips
node tools/promo/render-cards.mjs # graphic layers
python tools/promo/build.py all --lang en # edit
Then the same for the other languages. Keep the phone unlocked with the development build in view; the script wakes the screen itself for every clip.
- One clip again: pass its name (
record-phone.mjs solve, and the same clip inrecord-audio.mjs).timing.jsonkeeps the rest. - Only edit again:
build.py shorts --only <name>. - Watch every output once for real: does the picture sit in the glass, is the text readable, is the end card on a whole board, and is there no click at a transition.
- Do not render an approved set again unless someone asks for it.
An ordinary laptop
Making video takes a lot of memory. This keeps it working on a laptop with 8 or 16 GB:
- Heavy steps one after another, not side by side. The edit, the sound run in headless Chrome and an Android build at the same time fill the memory. Look at how much is free before such a step. When it gets full, an agent such as Claude Code stops its background tasks halfway.
- The edit in groups of three or four segments. Join all segments in one
xfadechain and ffmpeg keeps every input open at once: with 14 segments that went up to 6.5 GB. Make a lossless intermediate file per group (-c:v libx264 -qp 0orffv1) and encode with crf 18 only in the last step. - One dev server at a time. Reuse the server that already runs, and stop it after the round. Start nothing loose in the background: what runs loose does not stop by itself.
- Do not build in a folder that syncs with the cloud (OneDrive, Dropbox, Google Drive). It uploads every intermediate file while encoding goes on. Build in an ordinary folder and copy only the output.
- Every still PNG gets a length and 60 fps (
-loop 1 -t <length> -r 60). An endless image feeds an overlay forever: one segment grew to 1.2 GB that way and never stopped. Give every ffmpeg call a time limit. - Recording with
screenrecordcosts the PC little: the work happens on the phone.
Learned
- Cut on marks, never on typed seconds. A take that lasts a second longer otherwise shifts every
cut. Let
build.pyrefuse a mark that is not intiming.json. - Cut the sound on its own mark. A phone sometimes drops frames, a browser does not. Let the sound run write the same marks, and find the sound per segment at the same moment.
- Solve with the same test as the game. A piece that is right again after half a turn counts as right in the game; a solver of your own that makes extra moves there shows a poor solution in every frame. Let the recorder refuse a take that is worse than needed.
- The screen mask is a rounded rectangle projected onto the glass, not the light pixels of the picture. Otherwise the old picture shines through as a second layer.
- Sound keeps a 4 second tail. Let
build.pyrefuse a cut that is longer than its sound; a silent stretch that is quietly padded sounds like a click at the transition. - Check every clip and record again when needed. Clips without a
moovatom, with the picture of an earlier recording, or entirely black (a frame from the middle of a few kB) do happen. - A sleeping screen freezes the WebView. Wake the device per clip with a key
(
KEYCODE_WAKEUP), and raise the screen timeout for the round and set it back afterwards. - Music only starts after a user gesture. A key press through Playwright gives one, a
click()inside the page does not. - Wait until the MediaRecorder has finished packing. A fixed wait that is enough for 40 seconds of sound is too short for two minutes of music.
- Device and browser run the same build. A hook that is in the source but not in the installed app breaks the recording halfway. Build and install first.
- Vite reloads the page at every change in the source. Do not work on the game while a headless
run goes on, or run it against
vite preview. - A tablet: lock the rotation for the round and release it afterwards. A tablet on the charger
sometimes goes into a screen saver that a key does not wake it from; start the activity again
(
am start). - Git Bash turns
/sdcard/...into a Windows path in single adb commands. SetMSYS_NO_PATHCONV=1; in the node scripts this does not happen. - Search for a seed rather than trying. If you want the bot to show something special, let a script in Node go through the seeds until one makes it happen. Ten lines, and it saves an afternoon.
- Scale on the device, not on the file. Two pictures of a phone do not have the same room around them. Measure the opaque edge and set the size and the position on that.
- The app icon as it is. Do not cut a rounding of your own into it; it fights the rounding of the icon itself.
Publishing
- YouTube: the trailer with the thumbnail, and the shorts as Shorts. Note the video ids.
- Your own site: load the video only on a click, through
youtube-nocookie.com, with a poster from your own render. That way the page sets no YouTube cookies before someone presses play. - The Play Store: in the Console, in the store listing, the Video field: the public YouTube link of the trailer, without ads and without an age restriction.
- Socials: the shorts and the teaser are 9:16 and ready for Shorts, Reels and TikTok. The sound is already at -14 LUFS.
- Put the title, the description and the tags per language of each video in a text file, with every paragraph on one line. YouTube takes spaces and line breaks literally; uploading is then copy and paste.
Checklist per round
- the development build on the phone is the same version as the one in the store
- the screen mask looked at after a new picture of the phone
- every language recorded, the texts in
cards.htmlread in every language - every output watched once: glass, text, end card, sound at the transitions
- heavy steps one after another, the edit in groups, the dev server stopped after the round
- the scripts in git, the output not

