Expert guidance on video optimization for web performance. Use when adding, auditing, or improving video on websites - hero/background videos, product demo videos, autoplay loops, GIF-to-video conversion, HLS/adaptive streaming, video posters and thumbnails, lazy loading video, YouTube/Vimeo embed performance, video Core Web Vitals (LCP/CLS/INP), video SEO/schema, or Sirv video hosting and streaming. Covers MP4/WebM/HLS delivery, H.264/VP9/AV1 codec choice, preload strategies, muted autoplay rules, facades for third-party players, and video-to-spin workflows.
74
93%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
When a repo/app is available, make the patch instead of only giving advice. Prefer local framework conventions over generic snippets.
poster (optimized image, not a video frame fetched late); the poster or a sibling image is the LCP candidate, not a spinner or black frame.<video> has explicit dimensions or CSS aspect-ratio before media loads.muted autoplay loop playsinline with no controls; browsers block unmuted autoplay, so never rely on it.preload="none" + poster for below-fold or click-to-play; preload="metadata" for likely-played; only streamed first segments preload for hero video.prefers-reduced-motion; controls are keyboard reachable.| Situation | Preferred Action |
|---|---|
| Hero/background ambient loop | Short (5-15s) muted MP4 (H.264) + WebM source, muted autoplay loop playsinline, poster, prefers-reduced-motion fallback to the poster. |
| Animated GIF anywhere | Replace with <video muted autoplay loop playsinline> or animated WebP/AVIF for tiny clips; 10-50x smaller. |
| Product demo / content video | HLS via a video host/CDN (Sirv, Mux, Cloudflare Stream, self-hosted hls.js) with poster, controls, preload="metadata". |
| Long-form or variable networks | Adaptive HLS ladder; never a single 1080p progressive MP4. |
| YouTube/Vimeo embed | Facade pattern (thumbnail + play button, swap to iframe on click); saves 0.5-1MB+ of third-party JS per embed. |
| Rotating product video | Consider converting to a 360 spin (../sirv-360-spin/SKILL.md) - lighter, interactive, no play button. |
| Existing Sirv account | Upload to Sirv; automatic HLS ladder + Sirv Media Viewer embed. Read sirv-video.md. |
| Video is the LCP element | Ensure poster renders instantly (preload it if hero); or stream with a tiny preloaded first segment. |
| Use Case | Default |
|---|---|
| Universal compatibility | H.264 (AVC) MP4, High profile, AAC audio |
| Better compression, wide support | VP9 WebM or HEVC (Safari) as a second <source> |
| Best compression, modern targets | AV1 (check hardware decode on mobile before committing) |
| Silent loops | Strip audio track entirely (ffmpeg -an) - saves weight and enables autoplay reliably |
| Streaming | HLS with 2-4 rung ladder (e.g. 360p/480p/720p/1080p); hosts generate this automatically |
Quality starting points: H.264 CRF 21-25 (lower = better), VP9 CRF 30-34, AV1 CRF 28-34. For ambient background video, go aggressive (CRF 26-28 H.264) - it sits behind content.
<video class="hero-video" autoplay muted loop playsinline
poster="hero-poster.jpg" preload="none"
width="1920" height="1080" aria-hidden="true">
<source src="hero.webm" type="video/webm">
<source src="hero.mp4" type="video/mp4">
</video>@media (prefers-reduced-motion: reduce) {
.hero-video { display: none; }
.hero { background-image: url(hero-poster.jpg); }
}Preload the poster (it is likely your LCP), not the video.
<video autoplay muted loop playsinline width="480" height="270"
aria-label="Description of the animation">
<source src="clip.mp4" type="video/mp4">
</video>Render a thumbnail (https://i.ytimg.com/vi/VIDEO_ID/hqdefault.jpg) with a play button; inject the iframe (with autoplay=1) only on click. Use an existing web component like lite-youtube-embed rather than hand-rolling when the project allows dependencies.
video.* options, thumbnails/posters, video-to-spin: sirv-video.mdSibling skills: ../image-optimization/SKILL.md for posters/thumbnails as images, ../sirv-media-viewer/SKILL.md for galleries mixing video with images/spins, ../sirv-360-spin/SKILL.md for spin conversion, ../sirv-api/SKILL.md for video2spin/spin2video jobs.
muted and expecting it to play.<video> with no poster - users see a black box while segments load and LCP fires late.playsinline), Android Chrome, and desktop; muted loops actually autoplay.prefers-reduced-motion shows the static fallback.IgorVaryvoda/image-optimization-skill
6000fda
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.