Communitygithub.com

垂直短影音構建器 — 分割畫面 Short/Reel 格式

建立一個分割畫面的垂直 Short/Reel(1080x1920),將真實人臉裁剪並固定在畫面下半部分,上半部分則包含自訂動態圖形與逐字字幕。

Reel 格式 是什麼?

這項技能提供了一個完整的技術框架,用於建立「分割畫面」垂直短影音格式(針對 YouTube Shorts、Instagram Reels 等平台)。其核心前提是主講人的臉部在整個影片期間始終保持在螢幕上,與典型的剪接/疊加模型(主講人形象會因概念節拍而中斷)截然不同。該技能採用一種「裁剪偏移」技術,將全高(1920 像素)影片元素在一個 960 像素高的視窗內向上偏移,從而精確地將臉部置於下半部分。此外,還提供了確保逐字字幕安全區域(永遠不會遮蓋臉部)的驗證程序、在不中斷主講人影像的情況下在畫面上半部分整合 UI/應用程式模擬場景的設計模式,以及從原始素材到最終混音檔案的完整建構管線。此技能主題無關,專注於佈局與技術,並支援無 NVIDIA GPU 的機器(需備用 CPU 編碼器)及處理 AAC 編碼前間隙等問題的因應措施。

相容平台~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/raisaksham377-bot/youtube-shorts-ai-editor/tree/HEAD/.claude/skills/build-vertical-reel

在你喜歡的 AI 中提問

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

說明文件

建立垂直 Reel — 分割畫面垂直 Short/Reel 格式

這是一個格式,而非主題:1080x1920 畫布的下半部分是主持人真實的 talking-head 素材, 經過裁剪並在整個影片中固定在畫面內;上半部分是一系列自訂的動態圖形節拍, 與旁白同步;逐字字幕則在整個影片期間位於畫面底部、下巴下方。 其前提是主持人的臉部永不離開螢幕 — 這正是此格式與 /make-tsx 的剪接/疊加模型不同之處 (該格式在概念節拍時會剪接離開 talking-head;此格式則從不離開)。 此處所有內容皆可應用於任何主題 — 以下為技術說明,基於建置一部真實影片的經驗撰寫, 以便同樣適用於下一個完全不同主題的影片。

佈局,從上到下

AbsoluteFill (1080x1920)
 └─ 背景層(全畫布 — 品牌背景或依影片自訂的處理)
 └─ 下半部影片 div:position:absolute, top:960, width:1080, height:960, overflow:hidden
     └─ OffthreadVideo,position:absolute, top:<CROP_OFFSET>px, left:0, width:1080, height:1920
 └─ 上半部內容:一個自訂場景或通用文字卡片,height:960,依節拍切換
 └─ WordCaptionOverlay — 永遠最後(最上層),因此字幕在每個節拍(包括 UI 模擬場景)中都能保留

影片元素被放大到完整的 1920 畫布高度,然後向上偏移 CROP_OFFSET, 使裁剪視窗(下半部 div,在其本地座標中為 0-960)落在畫面的正確位置。 這就是整個技巧 — 繼續閱讀以了解如何找到該數值。

1. 裁剪偏移技術(臉部構圖)

您正在使用 1080x1920 的來源(或根據該規格轉碼的來源 — 請參閱環境章節) 並僅在底部一半顯示一個 1080x960 的視窗。CROP_OFFSET 是應用於該裁剪視窗內 全高影片元素的 top 值(通常為負數)。

公式,一旦您有了 CROP_OFFSET:

canvas_y = 960 + (video_local_y - CROP_OFFSET)

video_local_y 是來源素材中的像素行(0 = 畫面頂部);canvas_y 是該行在最終 1920 高畫布上的位置。任何 canvas_y < 960(在視窗上方被裁剪)或 > 1920(在視窗下方被裁剪)的內容都不可見。

如何為新影片找到 CROP_OFFSET(不要猜測 — 測量):

  1. 選擇一個候選偏移量(從 0 或前一個影片的值作為粗略先驗開始)。
  2. 以該偏移量渲染合成畫面的一張靜止幀。
  3. 觀察它。底部一半頂部的髮際線/頭部是否被切斷?偏移量太小(負得不夠)— 將其推得更負,以將影片內容上移並露出更多頭部。頭部上方是否有太多空白區域?偏移量太負 — 將其拉回接近 0。
  4. 重新渲染,重新觀察,收斂。兩到三次迭代是正常的。這與此 repo 中其他所有內容的「渲染靜止幀並實際觀察」紀律相同 — 切勿未經檢視就送出裁剪偏移量。
  5. 一旦收斂,使用上述公式計算您稍後需要的任何標記點(眼睛、下巴、衣領)的 canvas_y,而無需每次都重新目測 — 您已經有了映射關係。

來自一次建置的實際範例(數字特定於該次拍攝的構圖 — 為任何新素材重新測量,不要重複使用它們):CROP_OFFSET = -140 將髮際線正好放在底部一半視窗的頂部(canvas_y ≈ 960),眼睛/眼鏡落在 canvas_y ≈ 1380-1470 左右,下巴/衣領線落在 canvas_y ≈ 1650-1850 左右。不同的構圖(更寬的鏡頭、不同的攝影機高度、坐姿 vs 站姿)將產生完全不同的數字 — 可轉移的是公式和測量-渲染-觀察循環,而不是常數。

2. 字幕藥丸安全區域(永遠不遮蓋臉部)

逐字字幕(lib/kit.tsx 中的 WordCaptionOverlay)通過 bottomPad prop 定位: 從完整 1920 畫布底部到藥丸底部的距離(以像素為單位)。更大的 bottomPad = 螢幕上更高;更小 = 更靠近底部邊緣。

此格式容易出現的錯誤: 選擇一個使藥丸正好落在眼睛/眼鏡上的 bottomPad — 在一幀的抽查中看起來沒問題(一個短詞,小藥丸),然後在一個長詞(更寬/更高的藥丸) 或構圖發生變化的不同節拍中失敗。曾經正是通過檢查多個不同的實際渲染幀才發現了這個錯誤, 而不是只檢查一個。

藥丸應放的位置: 下巴下方,衣領/上胸線處 — 在任何詞長度下都遠離臉部, 因為這通常是靜態攝影機鏡頭,頸部線條不會隨幀而移動。使用 §1 中的裁剪偏移公式 將您測量的下巴/衣領 video_local_y 轉換為目標 canvas_y,然後反向計算: bottomPad = 1920 - canvas_y_target(大致如此 — 藥丸在其底部邊緣上方有一定高度, 因此將 bottomPad 設定為比原始減法稍小一點,然後驗證)。

在調用一個 bottomPad 值完成之前的驗證清單(所有這些,而非子集):

  • 渲染多個不同詞語的靜止幀,而不只一個,包括轉錄稿中最短的詞(最窄的藥丸) 和最長的詞(最寬/有時最高的藥丸 — 檢查它不會換行或長入危險區域)。
  • 渲染不同節拍/場景的靜止幀,因為某些節拍可能會改變底部一半的可見內容 (上半部分的滿版 UI 模擬不影響此點,但未來裁剪或構圖的任何變化都會影響)。
  • 實際觀察每張靜止幀。確認藥丸位於下巴/頜線下方,並且沒有漂移到頸部的陰影或眼睛上。

3. 僅限上半部的 UI/應用程式模擬場景模式

有時一個節拍需要具體的螢幕操作 — 點擊按鈕、填寫表單、滾動頁面 — 以真實(模擬的)UI 顯示,而不是用文字描述。直覺反應是將其建置為自己的全螢幕 Remotion 合成並通過 <Sequence> 放入,就像 /make-tsx 的剪接鏡頭在此 repo 其他部分 的工作方式一樣。不要在這裡這樣做 — 全螢幕剪接會在其整個持續時間內隱藏 talking-head, 這破壞了此格式的整個前提。兩種真實的症狀可以判斷是否做錯了:模擬畫面覆蓋整個頁面 而不是與臉部分享,以及模擬畫面從未出現在最終合成中,因為全螢幕 <Sequence> 是作為 單獨的疊加層接入的,而不是通過其他所有內容使用的節拍排程系統(在一次真實建置中 兩種情況都發生了;兩次都浪費了完整的渲染和審查週期)。

從真實的捕捉來源獲取模擬畫面,而不是手繪的複製品(brand.md §6,創作者回饋 2026-09-03)。 examples/shorts/ 中的兩個範例 Reel 都從頭開始手寫了一個假的 LinkedIn 「Easy Apply」UI(一個完全由肉眼選擇的 CSS 框/顏色構建的 LinkedInTopScene)— 它有效,但它是捏造的 UI,當真實事物存在時(幾乎總是存在:實際的職位發布、實際的應用程式、 實際的公司頁面),它嚴格來說更差。在手繪 ANY UI 模擬之前,花兩分鐘檢查是否可以 捕捉真實的代替:針對真實的公開 URL 使用 tools/capture_web.py → media/projects/<video>/real/ 中的真實 PNG → 將那些點陣圖用作場景的內容(通過 <Img src={staticFile(...)}>, 根據下面的第 3 點裁剪/縮放到上半部區域),而不是在 JSX 中重繪頁面。僅在沒有真實等效物 (假設/未來的 UI、您無法訪問的競爭對手頁面、私人/經過驗證的檢視)時才回退到手繪複製品 — 並在這樣做時在註解中說明。

正確的模式 — 將其視為與其他所有自訂場景完全相同:

  1. 建置一個場景元件 SomeUiMockupScene: React.FC<{ frame: number; holdFrames: number }>, 限制為 height: 960(僅上半部),完全由 frame/holdFrames props 驅動 — 而不是在內部調用 useCurrentFrame()。它不包裹在自己的 <Sequence> 中; 外部節拍排程器計算 localFrame = frame - card.startFrame 並直接傳入, 與文字卡片或圖示動畫相同。
  2. 陷阱: 可重複使用的 chrome 元件(瀏覽器視窗框架、手機狀態列元件等) 經常在內部調用 useCurrentFrame() 來驅動它們自己的入場動畫。這讀取的是 全域時間軸幀,一旦場景由本地幀而不是 <Sequence> 驅動,這就錯了 — 入場動畫要么在錯誤的時間觸發,要么(如果節拍在幀 0 之後很久才開始)從未可見地觸發。 要么手動製作一個為上半部區域縮放大小的 chrome 較小版本(最安全 — 完全控制縮放和時間), 或者,如果重複使用共享元件,則傳遞其 appearAt prop 等於節拍的全域開始幀, 使其內部比較與本地幀 0 實際發生的時間對齊。
  3. 將每個座標縮放以適合 1080 寬 x 960 高且帶有邊距 — 不要只是將 1080x1920 模擬畫面裁剪到 其頂部 960px,否則您將裁剪掉底部任何 chrome/底座(筆電底座、手機主畫面指示器、 瀏覽器較低的內容)。為較小的畫布重新推導框/按鈕座標,而不是重複使用全螢幕版本的數字。
  4. 任何游標/點擊微交互(可從 lib/screencast.tsx 的 sampleCursor / CursorPointer / CursorKey 重複使用):關鍵幀座標是視口分數(0-1),而不是像素 — 因此它們與 畫布大小無關。只需在放置游標時,一致地使用區域本身的尺寸進行乘法 (例如 cur.x * 1080, cur.y * 960),而不是完整的 1920 畫布高度。
  5. 將其接入與其他所有場景相同的節拍排程表(一個類似 Card 的列表,包含 startFrame/endFrame/scene, 由一個 if (activeCard.scene === 'x') return <XScene .../> 鏈分發)。這意味著 相同的模擬元件可以在時間軸上免費出現在多個點 — 只需在排程中添加第二個引用相同場景的條目 — 而不是複製元件或接入第二個特製的 <Sequence>。

4. 完整管線,從原始素材到最終交付檔案

此格式是疊加在現有管線之上的,而非取代:

  1. /clean-cut 對原始 talking-head 素材進行處理 → 獲得批准的母版剪輯 + edited-transcript.json (母版時間軸中的逐詞時間戳)。與標準管線相同 — 首先執行此步驟,完全按照其文件記錄進行, 包括其自己的使用者審核關卡。
  2. 壓縮原生轉碼 — Remotion 的 OffthreadVideo 需要一個解碼友善的來源。無論母版的原生規格 為何,將副本轉碼為此格式的目標(1080x1920,30fps,8-bit H.264):
    ffmpeg -i master.mp4 -vf "scale=1080:1920" -r 30 -c:v libx264 -pix_fmt yuv420p -c:a copy master-comp-native.mp4
    
    跳過此步驟並將 OffthreadVideo 指向高比特率/奇怪幀率/10-bit 的母版會使渲染期間的 解碼器資源耗盡 — 導致重複幀、可見卡頓、感知不同步(在 /clean-cut 中也有記錄; 由於影片在整個執行時間內播放而不僅僅是剪接片段,因此在此處同樣嚴重)。
  3. 根據上方 §1 找到 CROP_OFFSET,並建置分割畫面外殼(背景 + 裁剪後的底部一半影片 div + 字幕疊加層)。
  4. 閱讀轉錄稿,決定節拍列表,並為每個需要衝擊力的節拍(為上半部區域慷慨縮放的圖示/動畫 — 此格式使用大膽、自信的圖形比使用小型、拘謹的圖形效果更好)或為純文字節拍使用通用文字卡片, 製作一個自訂場景。任何需要具體 UI 時刻的節拍應遵循 §3。
  5. 添加/重新命名任何場景檔案後執行 npm run gen(鏡頭註冊表是生成的,而非手動維護 — 與此 repo 的其餘部分規則相同)。
  6. 在每個新節拍的關鍵幀處渲染證明靜止幀(入場、中間保持幀,以及 — 對於任何與字幕相鄰的內容 — 根據 §2 的清單)並在繼續之前實際觀察它們。先執行 npx tsc --noEmit 以低成本捕獲類型錯誤, 然後再花費渲染時間。
  7. 渲染完整的合成。
  8. A/V 持續時間關卡 — 對 v:0 與 a:0 執行 ffprobe -show_entries stream=duration。影片 軌道持續時間必須完全等於預期的合成長度。請參閱下方的 AAC 注意事項,了解為什麼在此階段 僅音頻軌道預期會略微不同。
  9. SFX 處理(/suggest-sfx 約定照常套用):撰寫/重複使用 sfx-plan.json,讓其接受審核, 然後混音:python tools/mix_sfx.py <path/to/sfx-plan.json>。陷阱: 腳本的位置參數是 計劃檔案路徑,而不是專案目錄 — 傳遞目錄會導致令人困惑的 PermissionError(它嘗試 open() 目錄本身),而不是有用的「錯誤參數」訊息。
  10. 重新驗證 SFX 混音輸出的持續時間(影片軌道仍應完全匹配;混音步驟通常也會使音頻軌道恢復 一致)。在更改過的節拍處抽取幾張最終靜止幀以確認沒有回歸,然後交付。

每當稍後更改一個節拍時,僅從步驟 6 開始為受影響的片段重新渲染 — 但 A/V 關卡(步驟 8) 和新的 SFX 混音(步驟 9)成本足夠低,可以始終在整個檔案上重新執行,而不是嘗試就地修補一個片段。

5. 環境陷阱(真實的,非假設 — 每個都遇到過一次)

  • 某些機器上無 NVIDIA GPU。 h264_nvenc / hevc_nvenc 和 -hwaccel cuda 在沒有 NVIDIA 顯卡的機器上會失敗,出現 Cannot load nvEncodeAPI64.dll。修正:回退到 CPU 編碼器 — 預覽級渲染使用 libx264,最終級使用 libx265 — 並完全移除 -hwaccel cuda 標誌 (一個空的硬體加速選項列表)。這是一個真實、可行的回退方案,而非降級/故障模式 — 只是速度較慢。保持易於恢復(一個常數/標誌),以供運行此管線的任何人使用。

Individual skills in this repo

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

raisaksham377-bot/youtube-shorts-ai-editor

Makes this repo's videos look like YOUR channel instead of the house default — interviews you for palette, fonts, wordmark, motion energy, delivery specs and SFX taste, then rewrites brand.md + remotion/src/brand.ts + remotion/src/fonts.ts together and renders a proof card so you SEE it. Use whenever the user wants to set up or change their brand, rebrand the repo, "make it my colors/fonts", change the accent color, set their wordmark, adjust the motion feel, or asks why their videos look like someone else's. Run it once before the first video. Not for per-video art direction (that is /make-tsx) and not for thumbnails, which are deliberately louder than the brand (that is /packaging).

raisaksham377-bot/youtube-shorts-ai-editor

Voice/audio cleanup step of the AI Video Editor pipeline — diagnose a video's background noise, pick the right denoise method, and produce a cleaned master (voice isolated, levels preserved, video stream copied). Use when the user wants to "clean the audio / voice", "remove background noise", "denoise", "isolate voice", fix outdoor/room/water/hum/hiss noise, run ElevenLabs Voice Isolator or local RNNoise, A/B denoise methods, or produce a cleaned master for a video-N in this repo. Covers diagnosing the noise (spectrogram + levels), choosing eleven vs rnnoise by noise type, the sample A/B, tools/clean_voice.py, preserving levels (RMS-match, not LUFS), and rewiring the pipeline to the clean master. Not the SFX/music mix (that is /suggest-sfx + the final-mix step) and not the cut (that is /clean-cut).

raisaksham377-bot/youtube-shorts-ai-editor

Step 1 of the AI Video Editor pipeline — turn raw talking-head footage into a clean master cut. Use when the user wants to "clean cut", "cut the raw footage", "remove filler / dead air / bad takes", "tighten the pacing", produce cuts.json, run the cut editor, or render a cleaned preview/master for a video-N project in this repo. Covers audio extraction, AssemblyAI transcription, authoring cuts.json (keeps/cuts/fluff categorized), the cut policy (content-aggressive, pause-natural ~0.5s), QA + review docs, the local cut-editor UI, tight/natural previews, the final 4K60 render, and producing edited-transcript.json as the handoff to /make-tsx. Not for building TSX overlays (that is /make-tsx) or the raw TSX authoring rules (that is vidtsx-2d-generator).

raisaksham377-bot/youtube-shorts-ai-editor

Turn static SCREENSHOTS into a simulated screen recording (TSX) — a fake screencast with an animated cursor that eases to targets and clicks, a browser URL bar that updates per page, hard-cut navigations, in-page filter crossfades, smooth scroll, and a ken-burns zoom onto the payoff. Use when a beat needs to show a walkthrough of a web app / dashboard / settings page and you'd rather build it from screenshots than get (or ask for) a real screen recording — "fake a screen recording", "turn these screenshots into a screencast", "simulate clicking through the dashboard", "animate this UI walkthrough", "cursor moving through the app". Built on remotion/src/lib/screencast.tsx. This is a technique WITHIN step 2 (make-tsx): defer timeline/render/bake orchestration to make-tsx and raw crash-free TSX rules to vidtsx-2d-generator. Not for a single static page clone (use WebBrowserFrame directly) and not when the point is genuine proof of real speed/output (use a real recording).

raisaksham377-bot/youtube-shorts-ai-editor

Step 2 of the AI Video Editor pipeline — build the visual beats (Remotion TSX shots) over a project's master cut and bake a composited preview. Use when the user wants to add/edit overlays or full-screen animation segments, "make a shot / beat", implement an edit plan or a v2 update, retime a beat to the narration, re-render shots, or re-bake the video-N preview in this repo. Covers reading the plan + edited-transcript + brand + reusable kit, authoring shots library-first, syncing reveals to word times, updating timeline.json (cutaway vs overlay), rendering, verifying by screenshot, and baking with tools/bake.py. Defers raw TSX authoring rules to vidtsx-2d-generator and the cut itself to clean-cut.

raisaksham377-bot/youtube-shorts-ai-editor

Generates click-optimized YouTube packaging — 3 thumbnail bets under one fixed title, engineered for YouTube's built-in A/B/C thumbnail test, plus a value-forward description, then renders the thumbnails as real images. Use this whenever you want to package a long-form video or turn a video idea into titles and thumbnails. Triggers include how would you package this, title ideas for, thumbnail concept, package this video, A/B variations, and make this clickable. Calibrates to your channel's own CTR data if you have it. Long-form only, never Shorts. Not for non-YouTube copywriting.

raisaksham377-bot/youtube-shorts-ai-editor

Step 4 of the AI Video Editor pipeline — the SFX pass. Analyze a video's beats + narration and propose tasteful sound effects synced to them, drawing from (and growing) a shared, reusable SFX library, then render an SFX-mixed audition preview. Use when the user wants to "add SFX / sound effects", "suggest sfx", "score the transitions", "sound-design this beat", generate/source sound effects, build or extend the sfx library/catalog, author or audit a sfx-plan, or mix SFX over a video-N preview in this repo. Covers reading timeline + edited-transcript + brand §10, the library-first flow, generating misses with the ElevenLabs Sound Effects API, the per-video sfx-plan.json, the hard user-audit gate, and mixing with tools/mix_sfx.py (light voice ducking). Not the music bed (that is the final-mix step) and not the visual beats (that is /make-tsx).

raisaksham377-bot/youtube-shorts-ai-editor

Generate production-ready 2D TSX video files for VidTSX (Remotion-based) from a shot, scene, or video description. Use whenever the user wants to create or generate a VidTSX video, a 2D TSX shot or scene, an animated clip, title card, or rendered motion graphic — including when they describe a visual animation they want built, or say "make a shot", "build this scene", "generate the TSX", or "turn this into a video". Covers the mandatory file structure and composition config, dimension presets (horizontal/vertical/square), six style presets (minimalist, memphis, neo-brutalism, glassmorphism, neon, corporate), and the hard rules that keep renders from crashing, covering frame-based animation only (no useState/useEffect/setTimeout), strictly monotonic interpolate ranges, Easing.bezier not wrapper syntax, and the chroma-js and @remotion/paths import gotchas. Not for 3D/three.js compositions, general React work, or editing video files.

相關技能