Communitygithub.com

ever-just/agentskills

將現有影片優化與嵌入網站,作為快速、清晰且自動播放的橫幅/背景/循環影片。當行銷網站要新增或更換影片,但檔案過大、無法自動播放(尤其在手機/Safari上)、出現編解碼器錯誤或畫面模糊時使用——將其轉碼為網頁安全的 H.264,搭配正確像素格式、faststart、Retina 感知尺寸與海報幀,然後嵌入並驗證實際播放。此技能僅用於優化與嵌入您已擁有的素材,而非創作或動畫影片(若要創作請改用 remotion/moviepy/motion-canvas)。當使用者說「將此影片加入網站」、「橫幅影片太大/無法播放/不夠清晰」、「更換首頁影片」或「讓此影片在登陸頁循環播放」時使用。

agentskills 是什麼?

這是一個專為 AI 代理(如 Claude Code、Cursor)設計的技能,能自動將現有影片(螢幕錄製、手機匯出、HEVC 渲染等)轉換為網頁安全的 H.264 格式,並嵌入網站作為自動循環的背景或橫幅影片。它解決了常見的影片問題:檔案過大(可從 8 MB 壓縮至 1.5 MB 且無明顯畫質損失)、在移動端或 Safari 上無法自動播放、編解碼器錯誤或畫面模糊。 技能會執行一連串步驟:先用 ffprobe 探測影片資訊,然後用 ffmpeg 進行轉碼(確保像素格式為 yuv420p、啟用 faststart、調整至 Retina 感知尺寸、移除音軌),再提取海報幀,最後生成正確的 HTML `<video>` 標籤。對於 Odoo 平台,它還會指導如何儲存為公開附件並更新視圖。完成後強制要求使用 CDP 渲染驗證工具在 Chrome 中實際測試播放狀態(readyState、paused、currentTime 等),確保影片能正常播放。 此技能支援任何標準 Web 開發環境,並特別針對 Odoo CMS 提供了整合指引。它不適用於創作或動畫影片,而純粹是對現有素材的優化與嵌入。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ever-just/agentskills/tree/HEAD/skills/web-embed-video-optimization

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

預覽

來自技能 README

說明文件

網頁嵌入影片優化

將來源片段(螢幕錄製、手機匯出、HEVC 渲染)轉換為快速、清晰、可靠自動播放的橫幅/背景/循環影片並嵌入。通常能獲得顯著改善:Retina 感知的 H.264 搭配合理的 CRF 值,能將 1080p 螢幕錄製從約 8 MB 壓縮至約 1.5 MB,且幾乎無可見畫質損失,並修復自動播放與編解碼器問題。

若需要創作或動畫影片,請改用 [[remotion]]/[[moviepy]]/[[motion-canvas]]——此技能優化的是您已擁有的素材。

使用時機

  • 在網站上新增或更換橫幅、背景或循環展示影片。
  • 影片檔案過大、無法自動播放(手機/Safari)、編解碼器錯誤或畫面模糊。

操作步驟

1. 先進行探測

ffprobe -v error -select_streams v:0 \
  -show_entries stream=codec_name,width,height,r_frame_rate,duration,pix_fmt,profile \
  -of default=noprint_wrappers=1 in.mp4
ffprobe -v error -select_streams a -show_entries stream=codec_name -of csv=p=0 in.mp4   # 是否有音訊?
# faststart 檢查:'moov' 是否在 'mdat' 之前?(moov 在結尾 = 啟動緩慢)

2. 轉碼(網頁安全 + Retina 感知)

ffmpeg -y -i in.mp4 -vf "scale=1600:-2" \
  -c:v libx264 -profile:v high -pix_fmt yuv420p -crf 23 -preset slow \
  -movflags +faststart -an -r 30 out.mp4
  • -pix_fmt yuv420p — Safari 與廣泛支援的必備設定(yuv444/422 無法播放)。
  • -movflags +faststart — 將 moov atom 移到前端,讓影片在完全下載前就能開始播放。缺少此選項,自動播放的橫幅在慢速網路下會停滯。
  • -an — 移除音訊;靜音的背景循環從不需要音軌(檔案更小)。
  • scale=1600:-2 — 編碼為約CSS 顯示寬度的 2 倍,而非原始 1080p/4K。在 ≤820px 的框架中,1600px 能達到 Retina 清晰度且檔案更輕。-2 保持高度為偶數(H.264 所需)。
  • -crf 23 -preset slow — 高品質、良好的壓縮率。螢幕/UI 內容的壓縮效果特別好;僅在檔案仍然過大時才將 CRF 提高至 25–26。

3. 海報幀

ffmpeg -y -ss 3 -i in.mp4 -vframes 1 -vf "scale=1600:-2" -q:v 3 poster.jpg

挑選一個具代表性的時間點(-ss),而非空白的片頭幀。

4. 嵌入

<video autoplay muted loop playsinline preload="auto" poster="/path/poster.jpg">
  <source src="/path/out.mp4" type="video/mp4"/>
</video>
  • muted + playsinline + autoplay 是行動裝置自動播放的必要條件。
  • 容器 CSS:video{display:block;width:100%;height:auto} 讓 16:9 的片段自行設定高度;用 overflow:hidden;border-radius 包裹在框架中。

5. 提供服務(Odoo 租戶)

以公開的 ir.attachment 儲存,並參考 /web/content/<id>(影片)和 /web/image/<id>(海報)——請參閱 [[everjust-website-customization]]。透過 docker cp 傳輸二進位檔案(shell 在容器內執行)。使用全新的附件 ID 並重新指向視圖,而非覆蓋舊 ID,以避免瀏覽器/CDN 快取過期。視圖編輯後需要重新啟動容器才能呈現。

驗證(強制執行)

使用 [[cdp-render-verification]] 確認影片確實播放——啟動 Chrome 時加上 --autoplay-policy=no-user-gesture-required,然後讀取 <video> 元素:

  • readyState === 4(HAVE_ENOUGH_DATA)、paused === false、currentTime > 0(經過短暫等待後有進展),且 videoWidth/videoHeight 與編碼設定相符。
  • 檢查桌面版和行動版,以及頁面是否沒有水平溢出的情況。

相關技能

  • [[everjust-website-customization]] — 透過 Odoo 附件提供服務與視圖嵌入。
  • [[cdp-render-verification]] — 播放驗證證明。
  • [[remotion]]/[[moviepy]] — 創作/動畫影片(相反的工作)。

Individual skills in this repo

This repo contains 9 individual skills — each has its own dedicated page.

ever-just/agentskills

> Declarative animations for React. Springs, gestures, layout animations, and page transitions. GPU-accelerated, production-ready.

ever-just/agentskills

> Create animated logos, icons, and micro-interactions as lightweight Lottie JSON files. No After Effects needed — build animations entirely in code.

ever-just/agentskills

> A TypeScript library using generators to program animations with a real-time editor. Ideal for explainer videos, code walkthroughs, and educational content.

ever-just/agentskills

> Add animated subtitles and captions to Remotion videos from .SRT files. TikTok-style word-by-word highlights, karaoke effects, and more.

ever-just/agentskills

> Create videos programmatically using React components. The most mature framework for code-driven video production.

ever-just/agentskills

> Copy-paste video components for Remotion. Intros, text effects, transitions, and full scene templates. Like shadcn/ui but for video.

ever-just/agentskills

Extract actionable intelligence from video content across YouTube, Vimeo, and company websites. Video reveals what text sources cannot: facility scale, team composition, product demonstrations, signage, event attendance, and operational reality.

ever-just/agentskills

Full conversion audit for any homepage or landing page. Use when someone asks to "review my homepage," "audit my landing page," "why isn't my page converting," "check my website," or wants feedback on their marketing page. Requires URL or screenshot before proceeding.

ever-just/agentskills

Automatically fetch YouTube video transcripts, generate structured summaries, and send full transcripts to messaging platforms. Detects YouTube URLs and provides metadata, key insights, and downloadable transcripts.

相關技能