How to make a looping background video with Claude Code
Quick answer: ask Claude Code for a short scene whose last frame equals its first frame, render it once with HyperFrames, then let FFmpeg repeat the file to any length. Because the scene is code, the join is exact and nobody sees it. A ReelStyles style kit such as the Cozy room loop gives you a finished look to ask for, so your only decision is the scene.
I run loops like this on my own channels and I sell the kits below, so weigh that.
The one rule of a loop
Every object must be in its first pose on the last frame. Any idle motion, like rain, steam or a breathing cat, runs on a period that divides the loop length. A 12-second loop can hold 2, 3, 4 or 6 second cycles, and a 10-second loop cannot hold a 3-second cycle without a jump. Say this rule in the prompt, and Claude Code plans the timings around it. Video models cannot promise this. Code can, because the same code gives the same frame every time.
The steps
- Install a kit. In Claude Code run
/plugin marketplace add reelstyles/reelstyles-freeand/plugin install reelstyles-free@reelstyles-free, then say "set up ReelStyles". It checks for Node.js, FFmpeg and Chrome and renders a 5-second test. Other agents clone the free repo as a folder. - Pick the scene and the length. A 10 to 20 second loop is enough. Longer loops take longer to render and gain nothing, since FFmpeg repeats the file later.
- Ask for the plan. Paste the prompt below. Claude Code lists every moving thing with its cycle length before it writes code.
- Check the join with two stills.
npx hyperframes snapshot . --at 0,11.95 -o snapshotssaves the first and the last frame. Put them side by side. If anything moved, fix that object before you render. - Render once.
npx hyperframes render . -o loop.mp4 --quality looks --workers 2. A 12-second loop renders in under a minute on a normal 4-core computer. - Stretch it to the length you need.
ffmpeg -stream_loop -1 -i loop.mp4 -t 3600 -c copy hour.mp4repeats the file for one hour without re-encoding. Change3600to the seconds you want.
A prompt to copy
Make a 12-second looping background in 16:9 (1920 x 1080) in the reelstyles cozy-room style: a painted room at night, rain on the window, steam from a mug, a cat breathing on the sofa, a lamp glowing. Every idle motion runs on a 2, 3, 4 or 6 second cycle. The last frame must equal the first. No text on screen. Plan first, then show me stills of frame 0 and the last frame before you build the rest.
For a phone wallpaper or a vertical stream layout, change the first line to "9:16 (1080 x 1920)" and keep the cat and the lamp in the middle third.
Where the loop goes
- A lofi or study stream. Load
hour.mp4as a media source in OBS and tick its loop option, or play the 12-second file on repeat. The join is exact either way. - A YouTube background video. Stretch to the length you want, add your music in your editor or with FFmpeg, and upload. The video renders silent.
- A website header. Keep the short file, and ask Claude Code for a 720p render if the page needs it smaller. Check the file size with
ls -lh loop.mp4before you upload it. - A Shorts loop. Shorts replay by default, so a 15-second film whose end meets its start reads as endless. The 9:16 guide has the safe-area numbers.
Styles made to loop
The Cozy room loop was built for this, with rain, steam and a sleeping cat on fixed cycles. The Painted anime sky drifts clouds over a small town, the Bioluminescent deep sea pulses jellyfish in black water, and Flow-field particles swirl without a start or an end. For loops with an action, like slicing or combing paint, read ASMR and satisfying animation videos with Claude Code. For the setup itself, see How to make animated videos with Claude Code.
FAQ
Can Claude Code make a loop with no visible join? Yes. It writes the scene as code, so it can make the last frame equal the first and give every idle motion a cycle that divides the loop length. Check the first and last stills side by side before you render.
How long should the loop be? 10 to 20 seconds. Render that once, then repeat the file with FFmpeg to any length. A longer loop only costs render time.
How do I make it one hour long? Run ffmpeg -stream_loop -1 -i loop.mp4 -t 3600 -c copy hour.mp4. It repeats the file without re-encoding, so the quality stays the same.
Can I add music? Yes. The render is silent. Add a track you have a licence for in your editor, or ask Claude Code to mix it in with FFmpeg.
Does it work for a stream background in OBS? Yes. Add the MP4 as a media source and tick the loop option. Since the file's end matches its start, the repeat is invisible.
Is this free? The free kits and local renders cost nothing per video. You need a plan for your coding agent. See what is free in HyperFrames.
Try it free
Get the 10 free style kits, or read the free repo on GitHub. If you want more looks, Full has all 140 styles for $79, Starter is any 5 paid styles for $29, and a single style costs $9. You pay once, and there is a 14-day refund.