How to add a video background hero with Claude Code
Put a looping video behind your headline with Claude Code: prepare the file with FFmpeg, markup that autoplays, contrast, reduced motion and page weight.
- For
- Developers and founders adding motion to a home page
- Written for
- Claude Code
- Time
- 4 min read · updated Oct 26, 2026
The short answer
- Cut a 5–15 second clip with FFmpeg into a small MP4 with no sound, and save its first frame as a poster.
- Ask Claude Code for a
<video>withautoplay muted loop playsinlinebehind the headline, an overlay for contrast, a pause button and the poster for reduced motion. - Check it on a phone and with reduced motion on, or install a hero skill that runs those checks for you.
Claude Code writes the markup for a video hero in one go. Most of the work is elsewhere: a file small enough to load on a phone, text that stays readable over every frame, and something sensible for visitors whose browser won’t play the video or who have asked for less motion.
What you need
- A clip of 5 to 15 seconds with steady camera movement and a calm area where the headline will sit
- FFmpeg on your
PATH(brew install ffmpeg,winget install ffmpegorapt install ffmpeg) - Claude Code, started in your site’s repository
Step 1: prepare the video file
Encode an H.264 MP4 without sound. Browsers only autoplay muted video, so an audio track is weight nobody hears.
-t 10keeps the first ten seconds. Add-ss 4before-ito start further in.-crf 26sets the quality: higher numbers make smaller, softer files. Try 23 to 30.-pix_fmt yuv420pkeeps the file playable in Safari and on phones.-androps the sound, and+faststartlets playback begin before the whole file has arrived.
Make a lighter copy for phones, and save the first frame as the poster that shows while the video loads:
Step 2: ask Claude Code for the section
Name the files, the attributes and the fallbacks in the prompt, so the first version is close:
The markup it writes should look about like this:
Step 3: check it
A video that plays for more than five seconds on its own needs a way to pause it, under WCAG’s Pause, Stop, Hide rule. The button above covers that.
Or start from a hero skill
Lookbk’s hero skills do the file preparation, fallbacks and checks for you, test the page at four widths and record an MP4 of it for launch posts. Scroll Film Hero takes your own clip and plays it as the visitor scrolls, as a full-bleed background or in a window beside the copy. The Footage Heroes ship their own retro film, with the headline behind the subject.
See the best video background hero sections for how they compare, and Install a skill in Claude Code to add one.
Common questions
- Why won’t my background video autoplay?
- Usually because it isn’t muted. Browsers autoplay video only without sound, and iPhones also need
playsinlineto play it inside the page. Keepautoplay, addmutedandplaysinline, and make sure the poster works for the times autoplay is blocked anyway. - Should I embed the video from YouTube or Vimeo?
- Not for a background. An embedded player brings its own scripts and controls, and you lose control of the poster and the fallbacks. Serve a plain MP4 from your own site or CDN.
- MP4 or WebM?
- H.264 MP4 plays in every current browser, so always have one. You can add a WebM
<source>before it, which is often smaller; browsers that can’t play it fall through to the MP4.
Sources
What this guide says about other companies’ tools comes from their own documentation, checked on Oct 26, 2026.
Did this guide help?
Read next
All guidesWebsite background video: size, format and performance
How to make a background video that loads fast and reads well: length, resolution, H.264 and AV1, the poster and LCP, autoplay rules, contrast and motion.
Text-behind-subject website heroes: how they work and how to make one
How the text-behind-subject effect works on a web page: a cut-out of the subject drawn over real HTML text, for a photo or a video, and how to build one.
How to install a skill in Claude Code
Three ways to add a skill to Claude Code: paste the install prompt, run the command, or unzip it into your skills folder by hand.
Make a product launch video with an AI agent
How agents make launch films from HTML, then a walkthrough from brief to MP4: pick a skill, capture real screens, approve a storyboard, fit a track, render.
See a skill’s result before you install it.
Every skill page shows what it makes, what it needs and which agents can run it.


