video-optimization
它能做什么
这个技能检查网站上的视频文件,并建议如何使其更小。它面向因视频而导致页面加载缓慢的网站所有者和开发者。
适用场景
- ✓页面加载了一个大视频,拖慢了首屏显示的时候。
- ✓网站把 4K 视频提供给小尺寸的手机屏幕的时候。
- ✓无声背景视频包含不需要的音轨的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/video-optimization/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的首页有一个背景视频,体积非常大。请帮我让它加载得更快吗?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会根据视频出现的位置,检查每个视频的分辨率、编解码器、音频和文件大小。然后它会建议为较小的屏幕重新编码并提供更小的版本。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Optimize and compress web videos
Unoptimized video is frequently the single heaviest asset on a page—an uncompressed or oversized video can dwarf every image and script combined, delaying Largest Contentful Paint and burning mobile data budgets.
Quick Reference
- Re-encode source video instead of shipping raw camera/screen-recorder output
- Serve multiple resolutions so mobile doesn't download a 4K file
- Prefer modern codecs: AV1/VP9/HEVC over baseline H.264 where supported
- Strip audio tracks from silent background/looping videos
Check
Scan this codebase for <video> elements and video asset references. For each one, verify: 1) The served resolution is appropriate for the rendered player size and device (no 4K video in a 400px player). 2) The codec/container is efficient (H.264 baseline is acceptable but VP9/AV1/HEVC is preferred when available). 3) Audio is stripped from silent background/looping videos. 4) A poster attribute or lightweight thumbnail is present. 5) File size is reasonable for its duration and placement (hero/background videos under a few MB). Report issues grouped by severity with file paths.
Fix
For each video optimization issue found: 1) Re-encode to multiple resolutions (e.g. 480p/720p/1080p) and serve the smallest one that fits the player via <source> or JS-based selection. 2) Convert to an efficient codec (VP9 or AV1 in WebM, or HEVC/H.264 in MP4) with a reasonable CRF/ quality setting rather than default encoder settings. 3) Remove the audio track from muted background/looping videos. 4) Add a poster attribute pointing to a compressed thumbnail. 5) Add preload="metadata" (or "none") instead of "auto" for below-the-fold videos. Show the corrected <video> markup and encoding command.
Explain
Explain why video is often the largest asset on a page and how it affects Largest Contentful Paint and mobile data usage. Cover the tradeoffs between H.264, HEVC, VP9, and AV1 (compression efficiency vs browser/ device support and encode time), how resolution and bitrate should scale to the rendered player size and viewport, and why muted background video should have its audio track stripped entirely rather than just muted in markup.
Code Review
Review video assets, <video>/<source> markup, and any encoding or CDN transform pipeline related to Optimize and compress web videos. Flag exact files or components where resolution, codec, bitrate, or loading behavior violates the rule, and describe how to confirm the fix in DevTools' Network and Media panels.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/performance/video-optimization
常见问题
哪种视频格式更好?
在支持的情况下,这个技能更倾向于 VP9、AV1 或 HEVC 等现代编解码器,而不是基础的 H.264。
为什么要提供多种分辨率?
这样手机就不必下载为大屏幕准备的大文件。页面会提供适合播放器的最小版本。
无声视频需要保留音频吗?
不需要。这个技能说,应去掉无声背景或循环视频中的音频。
详情
作者的原始描述
Use when reviewing <video> elements, background/hero video, or embedded media assets. Check encoded bitrate, resolution relative to the rendered player size, codec/container choice, and whether a poster/thumbnail avoids blocking on the first frame.
热度
- GitHub 星标
- 75k
- 排名
- #3074
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。