עברית 📰 Blog
← Back to Blog
AI Tools

How We Made a 22-Second Video Ad With Code Only, Music Included

Stav Adam
Founder, Masterphub
October 15, 2026

Share this article

How We Made a 22-Second Video Ad With Code Only, Music Included
Short answer: The whole ad is a small program. Claude wrote React code for the visuals (rendered with Remotion) and a Python script that synthesizes the music. Every word, color change and camera shake is tied to the beat by simple math. No camera, no stock footage, no editing app.

What you need

  • Claude (or Claude Code if you want it to run the commands for you).
  • Node.js and the free open-source library Remotion, which turns React code into video.
  • Python with NumPy for the music.
  • About an hour for the first video. Rendering 22 seconds took about two minutes on a regular laptop.

Step 1: pick a tempo that fits the frame rate

This is the trick that makes everything land on the beat. At 150 beats per minute one beat is 0.4 seconds. At 30 frames per second that is exactly 12 frames. So beat number n starts at frame n × 12, with no rounding. Choose a tempo and frame rate that divide cleanly and the sync takes care of itself.

Step 2: write the timeline as a list

Before any code, write the ad as a table: which beat, how many beats it lasts, which word, which effect. Ours is 55 beats: a 3-2-1 countdown, the question, the numbers, the categories, a build-up, the drop, and the logo. This list is the script, the edit and the storyboard in one place.

Step 3: let Claude write the music

Ask for a Python script that synthesizes a 22-second track at 150 BPM and saves a WAV file: a kick on every beat, hi-hats, a clap on beats 2 and 4, a bass line, a snare roll for the build-up and a deep hit when the logo appears. Because the song is generated by your own code, there is no licence to clear.

Step 4: give every section its own world

Our first versions looked the same from start to end. What fixed it was a different background for each part: falling letters, a wall of flying prompt cards, warp-speed streaks, a color burst with an icon per category, a retro grid with a loading bar, and a spinning honeycomb with lasers for the drop. Each world is one React component that switches on at its beat.

Step 5: drive the motion from the beat

One line does most of the work: kick = exp(-(frame % 12) / 3). It jumps to 1 on every beat and fades out. Use it for camera shake, zoom punches, glow and particle bursts, and the whole video breathes with the music. Words get their own entrance on their beat: slam, flip, spin, slide or letters flying in from all sides.

Step 6: render, look, fix

Render still frames from each section before the full video. That is where we caught a word running off the screen and a purple word on a purple background. Then render the MP4 and compress it for social.

A prompt to start with

Write a 22-second vertical (1080x1920, 30 fps) video ad in Remotion for [YOUR PRODUCT]. Tempo 150 BPM, so one beat = 12 frames. Use this timeline: [BEAT, LENGTH, TEXT, EFFECT for each line]. Start with a 3-2-1 countdown. Give every section a different animated background. Add camera shake and zoom on each beat with exp(-(frame % 12)/3). Also write a Python NumPy script that synthesizes matching music to a WAV file. Text in [LANGUAGE]. No images, no stock footage, everything drawn in code.

Who it's for

Creators and small businesses who want short, loud promo videos that can be changed in minutes: new numbers, new language, new product. Our Hebrew and English versions came from the same code with the words swapped.

What to watch out for

  • You need to run Node and Python somewhere, on your computer or through Claude Code.
  • Keep flashes to a few per second at most, for viewers sensitive to light.
  • Long words in a big font overflow fast. Check a frame from every section.
  • Every number on screen should come from a real source.

Source: Remotion (remotion.dev), built with Claude.

More AI tools and ready prompts at masterphub.io

Share this article