Communitygithub.com

social-video-captions

Add burned-in karaoke captions to a vertical talking-head video (Reels / TikTok / Shorts / Facebook), make a matching cover image, and write per-platform post captions. Built for Azerbaijani (works for other languages). Use when the user has a CapCut/phone video and wants captions/subtitles, a cover/thumbnail, or post texts — especially "add captions to my video", "make a cover", "use the words I actually said".

social-video-captions란 무엇인가요?

social-video-captions is a Claude Code agent skill that add burned-in karaoke captions to a vertical talking-head video (Reels / TikTok / Shorts / Facebook), make a matching cover image, and write per-platform post captions. Built for Azerbaijani (works for other languages). Use when the user has a CapCut/phone video and wants captions/subtitles, a cover/thumbnail, or post texts — especially "add captions to my video", "make a cover", "use the words I actually said".

지원 대상✓Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/kerimoff/video-edit-skill/tree/HEAD

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Social video captions + cover (house style)

End-to-end workflow that was built and approved on the "AI IS COMING" Reel (Oct 2026). Scripts live in scripts/ next to this file ($K below = this skill's directory).

Hard rules

  • Never touch the audio. Video is re-encoded, audio is stream-copied. burn_in.sh prints the audio MD5 of source and output — they must match. Frame count must match too.
  • Captions use the words actually spoken, not the prepared script. The script is only used for spelling/orthography and to fix Whisper mishearings.
  • Propose before rendering. The user wants to see style options as mockups on a real frame and pick one (and often asks for "N variants" of the chosen one) before the full render. Same for covers: show 3 variants side by side with the 3:4 crop outlined.
  • No fear hooks in covers or post texts ("Geridə qalmayın!" was rejected). Prefer optimistic / curiosity / invitation hooks.
  • Nothing may cover the platform UI (see Safe zones). The renderer asserts this; don't weaken the assert to make something fit — shrink or rewrap instead.
  • Claude cannot listen to audio — transcription needs a local model (ask before the ~1.6 GB download if not cached).

Setup (once per machine)

python3 -m venv ~/.cache/social-captions-venv
~/.cache/social-captions-venv/bin/pip install faster-whisper pillow numpy

Font: Montserrat variable (~/Library/Fonts/Montserrat[wght].ttf) — needed because Arial Black / Impact / Futura lack ə, ğ, ı. Homebrew ffmpeg here has no libass/drawtext, which is why captions are rendered as PNG states with Pillow and overlaid.

Workflow

1. Inspect

ffprobe the video (resolution, fps, duration, color: the Reel was 2160x3840 HEVC 30fps SDR bt709, AAC). Pull a contact sheet (fps=1/2,scale=180:-1,tile=11x3) to spot on-screen graphics (e.g. CapCut intro name cards) and where the face/chin sits.

2. Transcribe (word timings)

~/.cache/social-captions-venv/bin/python -I $K/scripts/transcribe.py VIDEO WORKDIR --lang az --prompt "key names and terms from the script"

Model: large-v3-turbo, int8 on CPU (~1 min for 1 min of video). Output: transcript.json, words_raw.json and a list of low-confidence words.

Gotchas seen:

  • Silences/SFX make Whisper hallucinate "İzlədiyiniz üçün təşəkkürlər" ("thanks for watching"). If a scripted line seems missing, check RMS in the gap and look at frames — on the Reel it was a CapCut intro card with a typing SFX; the line had been cut in the edit. Don't caption it.
  • The first word after a long gap can get a stretched start time; clamp it to ~0.35 s before its end.

3. Correct the words → words.json

Write a small per-video fix script (list of {"w","s","e"}). Compare transcript vs. script and:

  • Keep the speaker's wording where it really differs (added clauses, "gözləməyin" vs scripted "gözləməyək", colloquial "danışacam").
  • Fix spelling from the script: Whisper drops/garbles Azerbaijani letters (tapşarıb→tapşırıb, tərqidənlər→tərgidənlər, Qeydiyyət→Qeydiyyat, Bugün→Bu gün).
  • Grammar-only mishearings → script form (e.g. "intellektdə tapşırıb" → "intellektə").
  • Fix punctuation/capitalization (punctuation drives chunking): commas between clauses, sentence capitals, quotes/“?” around quoted questions, merge "Addım" + "-addım,".
  • Report every judgment call to the user afterwards.

4. Render caption overlay + SRT

python3 $K/scripts/render_captions.py VIDEO WORKDIR/words.json WORKDIR --cta noyabrda,yayımda,Qeydiyyat --bottom 0.75
python3 $K/scripts/safezone_check.py VIDEO WORKDIR WORKDIR/safezone.png 13 33 61   # look at it!
$K/scripts/burn_in.sh VIDEO WORKDIR OUT_captioned.mp4

Print-out shows every chunk (line1 / line2, [CTA]). Read it for bad breaks before burning. Then spot-check 4–5 frames of the output.

5. Cover (1080x1920)

Always start by proposing 10 photo candidates — the user picks one, THEN make the cover variants from it. (User request, Nov 2026.) Criteria, in order: good lighting on the face, positive face (smiling is best), good-looking (eyes open, sharp/no motion blur, relaxed mouth = not mid-word, face centred, room above the head for the headline overlay).

# 1) candidates: samples every take at 2 fps, scores with Core Image (smile, eyes) + exposure/sharpness/not-talking, 1 per take
python3 $K/scripts/multitake/cover_candidates.py VIDEOS_DIR TXDIR WORKDIR --mirror     # --mirror for DJI front-camera footage; ~4 min for 18 min of takes
#    -> show WORKDIR/candidates_sheet.jpg (numbered 1-10) and ASK which one. Don't make covers before the user picks.
# 2) variants of the chosen frame (full-res 4K, upright):
python3 $K/scripts/multitake/covers.py WORKDIR/candNN.png COVWORK OUT --upright         # 4 overlay covers + big-pill V4, previews

Look at the sheet yourself before showing it; swap out any candidate with closed eyes, blur or an odd expression (take the next-best from candidates.json). If the user instead pastes a screenshot, use covers.py SCREENSHOT ... without --upright (it rotates + un-mirrors). covers.py's headline texts are this video's — edit the C list per video.

Manual building blocks (what covers.py does under the hood):

sips -r 270 photo.jpg --out upright.jpg      # only if sideways (sips rotates clockwise); upright photo → cleaner mask
swift $K/scripts/person_mask.swift upright.jpg mask.png      # macOS Vision person segmentation, no download
python3 $K/scripts/make_cover.py upright.jpg cover.jpg \
  --headline "SÜNİ İNTELLEKT|SÜRƏTLƏ GƏLİR" --question "HAZIRSINIZMI?" --sub "5 noyabr · canlı yayım" \
  --mask mask.png --headline-y 318 --preview preview.png

Tune --headline-y so the head hides only the bottom ~quarter of the middle letters of line 2 (on the Reel: 290 = barely touching, 318 = right, 355 = hides whole letters). Without --mask the headline sits in front (use --headline-y ~255, above the beanie).

6. Post captions

Write Instagram, Facebook, TikTok, YouTube Shorts texts (see templates below).

Caption style (approved: "boxed caption + yellow karaoke pop", variant 3)

Values are for 2160 px width; the script scales by W/2160.

  • Font Montserrat ExtraBold, 135 px; line height 178; max text width 1340 (+pop reserve).
  • Up to 2 lines, ≤5 words per chunk, each line in its own rounded dark box: black @ alpha 185, radius 42, pad 55 × 32.
  • Text white. Spoken word: yellow #FFCE00, scaled ×1.12 ("pop"), layout reserves the popped width so neighbours never collide.
  • Chunks that don't fit shrink as a whole (e.g. "Uyğunlaşmayanlar").
  • Chunking: split at sentence ends (. ? ! :), then at commas, then balance oversize clauses; never strand "və"/"ki" at a chunk end; a number + next word ("5 noyabrda") is one karaoke unit and starts a new chunk.
  • Timing: each word highlighted from its start to the next word's start; chunk holds 0.35 s after its last word; gaps < 0.5 s are bridged (no flicker). No captions over silent intro cards.
  • CTA chunks (--cta keywords): yellow box #FFCE00 @ 240 with dark #141414 text; the active word still pops.
  • Position: last line's bottom at 75 % of height (user moved it 5 % lower than the first 70 %), centered. Boxes ended at x 16.5–83.5 %, y 65–75.5 %.

Safe zones (union of TikTok, Instagram Reels, Facebook Reels)

  • Right action buttons: x > 87 %, y 40–86 %
  • Bottom username/caption/music: y > 78 % (Reels is the strictest)
  • Top bar: y < 10–12 %
  • Caption boxes must stay inside x 7–84 %, y 12–78 % (asserted in code).

Cover style (approved: D5)

  • Photo color ×1.12, contrast ×1.06; dark gradient top (0–560 px, alpha 120→0) and bottom (1150–1920, 0→140).
  • Headline: one dark box (black @ 200) with 2 centered lines, Montserrat Black ~104 px, white.
  • Question: big yellow pill (dark text, ~120 px) on the chest at y≈1360; under it a small dark pill with the live-stream line (~62 px).
  • Person layered in front of the headline box (Vision mask, blur 1.2, only above y=900) so the beanie hides a little of line 2.
  • All text inside the 3:4 profile-grid crop (y 240–1680 on 1920) — previews draw that crop in blue.
  • Headline that won: "Süni intellekt sürətlə gəlir. Hazırsınızmı?" Liked alternatives: "Yeni savad: süni intellekt", "Bu sualı hər gün verin", "Düşünməyi AI-a tapşırmayaq", "Gələcəyin peşələri". Azerbaijani question particle is attached: Hazırsınızmı (not "Hazırsınız mı").

Post caption templates

  • Instagram: hook line + emoji → 2–3 short paragraphs of the message → the "daily question" in 💡 quotes → 📅 event line → "🔗 Qeydiyyat linki profildədir." → a comment question → 5–7 hashtags.
  • Facebook: longer, conversational, can include the link directly (Qeydiyyat: [LİNK]), ends with "valideyn dostlarınızla paylaşın 🙏".
  • TikTok: 1–2 sentences + link-in-profile + hashtags.
  • YouTube Shorts: title < 100 chars with #shorts; description with link; exactly 3 hashtags (they show above the title).
  • Use written forms in post texts (danışacağam), even if captions keep spoken forms.
  • Hashtags used: #süniintellekt #AI #təhsil #valideynlər #gələcəyinpeşələri #texnologiya #azərbaycan

Deliverables (in the project folder)

NAME_captioned.mp4, NAME_captions.srt (importable into CapCut: Text → Captions → Import), cover_*.jpg. Working files go in the scratchpad.

Multi-take edits (raw takes → several Reel versions) — added Nov 2026 ("15 ildə 4 sahə")

Scripts in scripts/multitake/ (paths are relative to the skill folder; assemble.py needs VIDEOS_DIR=<folder with the takes>).

  1. batch_tx.py VIDEOS_DIR TXDIR — one model load, transcribes every take (json + 16 k wav). If the HF model download hangs at 0 bytes, kill it and rerun with HF_HUB_DISABLE_XET=1.
  2. words.py SP take[:from:to] ... — word timings with pauses, to pick takes per script sentence. Later takes in a series are usually the keepers; check Whisper-garbled long takes by re-transcribing just the snippet with the script as prompt.
  3. Spec per version (example_spec_v*.json): list of [take, from, to]; maxgap/keep control how hard pauses are tightened. plan.py snaps cuts to real silence (RMS), only cuts pauses that are actually silent, quantizes to frames, alternates punch-in zoom 1.0/1.14 on every cut, warns on loud edges, and writes edl.json + words_auto.json already in the final timeline (no re-transcription needed). End tail 0.15 s — longer tails catch the phone starting to move.
  4. assemble.py EDL OUT WORKDIR — DJI clips are 4K with rotation=90 and mirrored (front camera): hflip, crop for zoom, 1080x1920 x264 CRF15, two-pass loudnorm −14 LUFS, AAC 192k.
  5. Per-video fix.py: spelling fixes + forced phrase breaks ("brk": true on a word) used by render_captions_brk.py; first caption starts at 0 s so the hook is on screen in frame 1.
  6. burn.sh (14 Mb/s HEVC, audio copy + MD5 check), cutsheet.py = frames at every cut boundary to review. Covers: when the head is high in frame the "head in front of headline" look hides too much — put headline + pill on the chest (--headline-y 1100 --question-y 1410, no mask). Version set the user asked for: full / tight (no filler sentence) / ~30 s essence / alternative hook (strongest line first). Intro card ("self-introduction overlay", tried on V1 Nov 2026): multitake/intro_card.py FREEZE.png MASK.png OUTDIR renders the card (~3.7 s; length is computed) (freeze of the hook's last frame → yellow bg crossfade, violet glow around the Vision cutout, slow push-in, 4 white boxes that pop in and type with a cursor one at a time — user found simultaneous boxes hard to read; each box types in ≤1 s (≥34 chars/s), 0.12 s gap, 0.5 s hold) + synthesized woosh/thump/keystroke SFX. Insert right after the hook; set SFX to ~−19 LUFS with alimiter=limit=0.7; shift caption words after the insert point and burn with overlay ... enable='not(between(t,T0,T0+card_len))' so no caption sits on the card. Box texts (4 boxes: name + title, age, expertise, a personal fact) come from intro_texts.local.json in the skill folder (git-ignored; JSON list of 4 boxes, each a list of lines) or the INTRO_TEXTS env var; placeholders otherwise. If the file is missing, ask the user for the texts. One-shot: multitake/add_intro.py CUT WORDS EDL SPEED OUT WORKDIR finds the hook end ("dəyişmişəm."), freezes, masks, renders the card, inserts, re-times and burns captions (works on sped-up cuts via SPEED). Cover photos pasted as screenshots of DJI frames arrive sideways AND mirrored: ImageOps.mirror(im.rotate(90, expand=True)). To get the "head in front of headline" overlay when the head is too high: shift photo + mask down P px (fill the top with a blurred stretch of the top rows, drop P px of sweater at the bottom), then --headline-y 240 --headline-size 96. Head top ≈ 445 px on 1920 = bottoms of middle letters hidden (approved Nov 2026, P=60). One-shot cover set: multitake/covers.py SCREENSHOT WORKDIR OUT (rotate+mirror, mask, auto headline height = head top − 212, auto shift if head too high, 4 covers + V4 big 2-line pill at 108 px — 128 px was too big). Big pill placement the user prefers: as LOW as possible — bottom 40 px inside the 3:4 crop (y≈1640), not right under the chin.

관련 스킬