How to Optimize Background Videos and Hero Media

Speed & Performance2 min readBy the Monopage team

A looping video behind the headline can make a homepage feel alive. It can also be the largest, slowest thing on the page, and a poor fit for phones. If you want hero media, set it up carefully.

Ask whether you need video

A video should earn its place. Consider a sharp image or a short animation instead, especially if the video is purely decorative. A hero image is simpler, loads faster, and works for everyone. See hero section design best practices.

If you use video

Keep it short and small

  • Aim for a loop of a few seconds to perhaps ten seconds
  • Reduce resolution to what the layout needs, often 1280 pixels wide or less
  • Remove the audio track from decorative video
  • Use efficient modern encoding, and compress well

A decorative background video should not weigh more than a few megabytes. Smaller is better.

Provide a poster image

Set a poster image so something appears immediately. Make that image your largest contentful element, optimized and loaded early, so the page does not wait for the video. See how to improve Largest Contentful Paint.

Load it after the important content

Start fetching the video after the page is usable. Use preload="none" or metadata where appropriate, and consider starting playback only once the page has loaded.

Do not autoplay on mobile data without thought

Many visitors are on limited data plans. Consider serving a still image on small screens or when data saving is requested, rather than the video.

Make it accessible

Technical settings

Background videos usually need to be muted, set to loop, and set to play inline so that phones do not open them in a full-screen player. Provide more than one format if you need broad support.

Other hero media

Test on real devices

Check load time, battery use, and smoothness on a mid-range phone on a normal connection.

Common mistakes

  • Using a huge, unoptimized file
  • No fallback image
  • No pause control
  • Text that is hard to read over moving footage

Text can also hold up the page if fonts load badly. Read font-display and flash of unstyled text.