Lorixen.
EN

A Looping Background Video in the Hero: A Four-Phase Plan to Keep It Light

Short answer: A silent looping video in the hero can look impressive, but it is often the heaviest thing on the page and the likeliest to hurt your loading speed on a phone. Keep it under about 5 seconds, aim for a file of a few hundred kilobytes, always provide a poster image that doubles as your main visual, and do not load the video at all on small screens, data saver mode or when a visitor prefers reduced motion. The plan below walks through four phases so you can decide whether it is worth it before anyone touches the code.

Phase 1: decide if the video earns its place

Ask three questions before you commission footage.

  1. Does movement explain something a photo cannot, such as a barista pouring, a surfboard being shaped, a vineyard in the wind?
  2. Will the headline and button remain legible over it?
  3. Are you prepared to maintain a lightweight fallback for people who never see it?

If the answers are mostly no, use a strong photograph. It loads faster, ranks the same, and is easier to make accessible. If yes, continue. Note that the clip is decoration. The page's message must be fully understood without it.

Phase 2: prepare the file

Length and loop

Choose a loop of 3 to 6 seconds. Longer clips cost more and rarely add meaning. Design the loop so the last frame leads smoothly into the first, or add a gentle slow-motion section so the seam is not obvious.

Dimensions and frame rate

For a background that sits behind text, 1280 by 720 is usually plenty, and 960 by 540 is acceptable if there is a blur or dark overlay. Reduce the frame rate to 24 or 25 frames per second. Remove the audio track completely; a muted video with an audio stream still carries those bytes.

Encoding

Provide two formats where practical: a WebM file and an MP4 with H.264. Use a constant quality setting rather than a fixed bitrate, and test until the picture is acceptable at the smallest size. As a rough working target, a few hundred kilobytes to about 1.5 megabytes suits a hero loop. These are guidelines, not guarantees; judge by your footage. Tools such as HandBrake or ffmpeg can do this, and the web.dev guide linked above explains the reasoning behind choosing video over animated GIF files.

The poster image

Export a still frame, compress it as a normal hero image, and size it with srcset. This image is what most visitors will see first, and it can be the Largest Contentful Paint element, so it deserves the same care as any hero photo.

Phase 3: build it with safe defaults

<video autoplay muted loop playsinline preload="none"
       poster="hero-960.jpg" width="1280" height="720">
  <source src="hero.webm" type="video/webm">
  <source src="hero.mp4" type="video/mp4">
</video>

What each attribute does:

  • muted is required for autoplay in most browsers.
  • playsinline stops iPhones from forcing a full-screen player.
  • loop repeats the clip.
  • poster shows the still image until playback starts, or permanently if the video never loads.
  • preload="none" avoids downloading the file until needed. Some browsers still fetch the start of an autoplaying video, so test the Network panel.
  • Fixed width and height reserve space so nothing jumps.

Place the text over the video using positioning and a semi-transparent overlay so contrast stays strong. Check the headline against the brightest frame, not just the poster.

Provide a pause control

If the motion lasts longer than five seconds, WCAG expects a way to pause, stop or hide it. A small, labelled button that calls video.pause() is enough. Make sure it is keyboard reachable and has a visible focus ring.

Phase 4: add the fallbacks that matter

Mobile and slow connections

Do not ship the same video to every phone. Two safe approaches:

  • Use a small script that inserts the source elements only when the screen is wider than, say, 48rem and the connection is not flagged as data saving. The navigator.connection.saveData flag exists in some browsers; treat it as a hint, not a guarantee.
  • Skip the video on small screens by hiding it with CSS and loading nothing, leaving only the poster.

Reduced motion

Honour the visitor's operating system setting:

@media (prefers-reduced-motion: reduce) {
  .hero video { display: none; }
}

Pair this with a script so the file is not fetched either, because hiding does not always prevent the download.

Failure states

Test with the file blocked. The poster should still fill the area and the headline should read well. If the poster is missing, the area collapses to a black rectangle, so set a background colour on the container.

Measure the cost

Open the Network panel on a throttled mobile profile and note the total transferred before and after adding the video. Run PageSpeed Insights or Lighthouse on mobile and compare Largest Contentful Paint. If the score drops sharply, shorten the clip, cut the dimensions or make the video desktop only.

A short pre-launch checklist

  • [ ] Clip under 6 seconds, no audio track.
  • [ ] Poster image optimised and used as the LCP candidate.
  • [ ] Text contrast checked on the brightest frame.
  • [ ] Pause button present and keyboard accessible.
  • [ ] Video skipped for small screens, reduced motion and data saver.
  • [ ] Tested on a real phone with mobile data.

FAQ

Will a background video hurt SEO?

Not by itself, but a slower page can. The poster and heading text are what search engines read.

Can I use a YouTube embed instead?

You can, but the embed adds scripts, tracking and branding, and it is heavier than a self-hosted short loop.

Why does autoplay not work on my phone?

Usually because the video is not muted, lacks playsinline, or low power mode is on. Low power mode can block autoplay, and that is normal.

Is a GIF easier?

GIF files are much larger than video for the same moving image, so a short MP4 or WebM is better.

If you are weighing a video hero against its speed cost, talk to us via our enquiry page and we will help you decide.

Sources

WhatsAppBook a call