# Video
## Formats
- Offer more than one source and let the browser pick: WebM with AV1 video and Opus audio first for the best compression, then MP4 with AVC (H.264) video and AAC audio as the broadly supported fallback. Check licensing for proprietary codecs, and check that the target clients decode AV1 before relying on it alone.
```html
```
- Replace animated GIFs with a short muted, looping video (`autoplay muted loop playsinline`); it is usually far smaller.
- For long or large videos, use adaptive streaming (HLS or DASH) through the project's existing player or video service instead of serving one large file.
## Playback and loading
- Autoplay only muted video or video without an audio track; browsers block autoplay with sound until the user interacts. Add `playsinline` for inline autoplay on iOS Safari. Never autoplay audio.
- Keep `controls` unless the design provides its own accessible controls, and give users a way to pause any moving content.
- Set `preload="none"` or `metadata` for videos the user may not play, and add `loading="lazy"` for offscreen videos where supported.
- Give every video a poster and intrinsic `width` and `height` to reserve space. When a video is the largest contentful element, preload its poster with high fetch priority and do not lazy-load it.
## Accessibility
- Provide captions (WebVTT `