Skip to main content
  • Pricing
Tutorials

How to Compress Video for a Website Without Losing the Point

Compress website video by defining its job, trimming unused material, choosing a supported delivery format, and checking file weight and visual quality in the actual page.

By Oakgen TeamPublished 8 min read

Share

Key takeaways

  • What is the best file size for a website video? There is no universal number. Set a page budget for the actual placement, then compare visual quality, start time, and bandwidth on a representative mobile connection.
  • Should I use MP4 or WebM? Choose according to browser support, encoding quality, and your delivery stack. web.dev describes multiple source formats and an MP4 fallback as one approach. Test the served files.
  • Compress video for a website by deciding what viewers must see, then removing everything that does not support that job.
How to Compress Video for a Website Without Losing the Point

Compress video for a website by deciding what viewers must see, then removing everything that does not support that job. Trim unused seconds, remove audio from silent loops, encode a delivery file at the displayed size, and compare it with the master in the real page. The smallest file is not automatically the best one: a product label that becomes unreadable has lost the video's purpose.

Website video can be a background loop, a product demonstration, a tutorial, or a testimonial. Each has a different tolerance for compression. A soft atmospheric loop can absorb more detail loss than a close demonstration of a tiny control. Start with the viewer task and the rendered dimensions. Then choose an encoding experiment. Do not begin by copying a universal bitrate from a blog post.

What makes a video heavy on a page?

Duration, resolution, frame rate, codec, motion detail, and audio all affect file size. A longer video carries more frames. A larger image has more pixels per frame. Fast motion, water, grain, and detailed foliage can be harder to compress cleanly than a stable tabletop shot. A container such as MP4 or WebM is not the same thing as the codec inside it. web.dev's video performance guide, read on 2026-12-02, explains that distinction.

The source file matters. A camera master may be designed for editing, not delivery. It can contain more data than a browser needs at the intended display size. Keep that master. Make a separate web encode and evaluate it. Recompressing a previously compressed social-media download can compound artifacts, so use the cleanest available source.

Page behavior matters too. An autoplay background loaded before the main text can compete with critical page resources. A click-to-play tutorial with a poster can defer much of its data until a viewer asks for it. Compression and loading strategy work together. A 3 MB file that loads on every visit may have a different impact from a 10 MB file that only an interested viewer requests.

What should you remove before changing codec settings?

Trim the edit first. If a 40-second source contains a useful 12-second demonstration, export the 12 seconds. Cut repeated intros, blank ends, and duplicate angles. A short truthful action often teaches more than a long montage. Do not trim away a required setup step merely to reduce bytes. The test is whether the viewer can still understand the process.

Remove audio if the video is genuinely silent or decorative. web.dev's guide shows FFmpeg's -an option for removing audio streams. A silent track still occupies space. For an instructional video with speech, keep audio and provide captions. The W3C media accessibility guidance explains why a transcript or captions can matter. Do not remove sound that carries essential information just to make a file smaller.

Consider whether every frame needs motion. A static title card held for five seconds can be a poster image with HTML text instead. A long freeze at the end of a product demo can be replaced by a page call to action. Moving factual text out of the video and into the page also makes it easier to update and read.

How do you choose a starting export?

Start with the real display size. A video rendered at a modest width in a product card rarely needs a huge source dimension, but a full-width hero may. Export a delivery version with enough detail for the intended crop and common device pixel densities, then inspect it at the actual layout size. There is no safe rule that "always use 720p" or "always use 4K." The content and layout decide.

Use a broadly supported format as a baseline and add an alternative format where the site and browsers benefit. web.dev discusses multiple <source> entries in a video element and how source order affects selection. If the site serves a WebM and MP4 version, check that the browser receives the intended one. A nominally smaller file is not helpful if the browser chooses a larger first source or cannot decode it.

Set a quality range and make two or three encodes, changing one parameter at a time. FFmpeg's documentation and web.dev's guide explain encoding options including quality controls. Record the command, codec, dimensions, duration, and output size. A reproducible record makes later updates faster and avoids losing track of which file was approved.

What does a concrete compression test look like?

Consider a hypothetical 18-second silent hero clip. The master is a 1920 by 1080 camera export showing a craftsperson at a bench. The website displays it at roughly half that width on desktop and uses a still poster on mobile. The team wants to preserve the hand movement and tool edge while reducing load. This is a proposed test, not an encode we ran or a performance result.

First, trim the master to the exact loop and remove its unused audio stream. Second, create a 1280-pixel-wide delivery candidate and a smaller 960-pixel-wide candidate with the same codec family and settings. Third, compare the files at the actual desktop display size, not only in an editing window. Pause on the fastest hand movement, the darkest background, and the loop seam. Fourth, measure file size and page loading under a representative throttled connection. Fifth, choose the smallest candidate that preserves the tool and hand clearly.

Suppose candidate A is 4.2 MB and candidate B is 2.7 MB in this invented planning illustration. The 1.5 MB difference is measurable, but it does not decide the choice alone. If candidate B blurs the tool edge that communicates the craft, A may be worth the cost or a different encoding setting may be better. If both look identical in the rendered page, B is a reasonable selection. Those sizes are hypothetical and should not be cited as typical outcomes.

Keep the source, each candidate, a screenshot of the rendered page, and the test conditions. Re-run the comparison after a redesign changes the hero size. Compression is relative to use. A file chosen for a half-width panel may be inadequate when the same video becomes full-width.

How do you use FFmpeg without turning the article into a preset?

An example command can show the shape of the workflow, but it cannot replace inspection. Start from a clean master and make an output file. For a silent loop, the -an option removes audio. The scale filter can change dimensions, and a quality setting controls compression. Confirm exact encoder options in the installed FFmpeg version and inspect the result.

ffmpeg -i source.mov -vf "scale=1280:-2" -an -c:v libx264 -crf 23 -movflags +faststart delivery.mp4

This command is an example, not a recommended quality target for every video. The -2 height keeps a codec-friendly even dimension while preserving the aspect ratio for this scale filter. -crf 23 is a starting experiment, not a promise of a particular file size or visual quality. Run another encode with a nearby setting or width, compare side by side, and keep the command with the file. If the source contains text or fine product detail, inspect those areas first.

Do not paste a command into production without knowing what the site needs. A platform may re-encode the upload. A browser may select a different source. A video with transparency may need a different format and support strategy. The goal is a controlled experiment with a verified delivered file, not a magical one-line compressor.

How do you inspect visual quality?

Watch at normal speed, then pause on difficult frames. Look for banding in gradients, blocks around fast motion, smeared hair or fabric, text that breaks apart, and color shifts. Compare the original and candidate at equal display size. A difference visible only at 400% zoom may not matter for a small background, while a tiny label that is unreadable at normal size absolutely matters for a product demo.

Check the opening frame and poster together. A compressed video may look darker or softer than the poster, causing a visible jump when playback starts. If the video loops, check the seam after several cycles. Some encoding choices can make the loop boundary more conspicuous. The exact file sent to the web server should be the one reviewed.

Ask a reviewer who does not know which file is smaller to choose whether either version fails the viewer task. A blind side-by-side can prevent the team from assuming the larger file must look better. Record the acceptance rule in advance: "The model number must remain readable" or "The hand and tool must remain separate during the fastest move." This is more useful than an abstract quality score.

How should loading and playback be tested?

Open the actual page on a phone and desktop. Test a normal connection and a slower one. Observe when the poster appears, when video begins, whether controls work, and whether text or buttons shift as media loads. Use the site's performance tools to see what bytes are transferred and when. web.dev connects video optimization to bandwidth and page loading, including the potential effect on Largest Contentful Paint. The relationship depends on implementation, so measure the page rather than assuming an encode alone fixes it.

Check reduced-motion behavior for decorative loops. A still poster should communicate the page without requiring playback. For a tutorial, provide an accessible player and captions. A video that technically loads fast but cannot be paused or understood without sound has not met its job. Performance and usability are both acceptance criteria.

Test multiple browser engines if the site serves multiple formats. Confirm the fallback works and source order selects what you intended. A codec that is efficient on one device may be unsupported or expensive to decode elsewhere. Keep an MP4 fallback where the chosen support plan requires it, and verify the actual served response.

When should you use an image instead?

Use a still when motion adds little information. A decorative shot of a product sitting on a table can often be a photograph. Use an animated format only when it helps a viewer see a process, change, or feeling that a still cannot provide. A click-to-play video can be placed lower on the page for people who want the full demonstration.

If the page hero has a large video but the main message is text, test the still version. It may load more predictably and make the call to action clearer. This is an editorial decision supported by a page test, not a general rule that video is bad. Keep the version that better serves the visitor under realistic conditions.

Where does AI-generated video fit?

Generated clips often contain motion detail that affects compression. A background with drifting particles can be expensive to encode and distract from page text. If the visual idea is abstract, try a simpler generated shot or a static image. Oakgen is our product; Oakgen's video generator can create illustrative footage, but it does not replace the web delivery and accuracy checks. Review the final encode for new artifacts and unstable details.

A generated product shot also needs truth review before compression. An encode can hide small AI errors, but it cannot make an invented port or label accurate. Compare the source with the actual SKU first. Then compress the approved visual. Keep those two review steps separate so a blurry file is not mistaken for a faithful product depiction.

What belongs in the final delivery record?

Save the master, delivery encode, poster, command or export settings, file sizes, intended placements, and a brief visual acceptance note. Record the page URL or preview where it was tested and the device conditions. This is enough to reproduce the result when the page changes. A future editor should not have to guess why the smallest candidate was rejected.

Keep the export preset with the delivery record. Record codec, dimensions, bitrate mode, frame rate, and whether the exported asset contains audio. If the editor replaces the source later, they can see exactly what changed and reproduce the earlier file for a fair comparison.

For a product tutorial, test the frame that carries the smallest necessary detail. The average scene may look fine at a smaller encode while the instruction on a tiny display or connector becomes unreadable. Write that detail into the acceptance sheet before comparing candidates. If a particular section needs more clarity, consider a separate still close-up beside the player instead of raising the bitrate of the entire video. This can give the viewer a pausable reference while keeping the moving explanation compact. Check the page as a whole, since the combination may work better than either asset alone.

How we checked this

We read web.dev's video performance guide, FFmpeg documentation, and W3C media accessibility guidance on 2026-12-02. We did not run the example command, measure a website, or benchmark codecs for this article. The hero, dimensions, and file sizes are illustrative. Test the actual encoded files and page before publication.

Frequently asked questions

What is the best file size for a website video?

There is no universal number. Set a page budget for the actual placement, then compare visual quality, start time, and bandwidth on a representative mobile connection.

Should I use MP4 or WebM?

Choose according to browser support, encoding quality, and your delivery stack. web.dev describes multiple source formats and an MP4 fallback as one approach. Test the served files.

Can I remove audio from a background video?

Yes if the video does not need sound. web.dev notes that FFmpeg's -an option removes audio streams and can reduce the file weight.

Does lowering resolution always make a video better for a page?

No. Lower resolution can reduce data, but it can erase text, labels, or product detail. Judge the encode at the rendered size and preserve a high-quality master.

Sources

  1. web.dev Video performance
  2. FFmpeg documentation
  3. W3C Making Audio and Video Media Accessible
Share