Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AI Builder Club Skills render sh

From Leeroopedia
Knowledge Sources
Domains Video_Processing, Subtitling
Last Updated 2026-10-24 00:00 GMT

Overview

Concrete tool for burning ASS subtitle captions into video using FFmpeg libass, provided by the karaoke-captions skill.

Description

The render.sh script wraps FFmpeg with the ass subtitle filter to burn karaoke captions directly into a video file. It supports three modes: full video render, preview segment (render a time-bounded clip for quick visual checks), and frame snapshot (extract a single frame at a timestamp). Uses libx264 with preset veryfast and crf 20 for video encoding, with audio passthrough (-c:a copy) to avoid re-encoding.

Usage

Run this script after generating ASS captions with gen_ass. Use preview mode to visually verify captions before committing to a full render. Use frame mode for static screenshot checks.

Code Reference

Source Location

Signature

# Full video render (no START/DUR)
render.sh <IN> <ASS> <OUT>

# Preview segment (time-bounded clip)
render.sh <IN> <ASS> <OUT> <START_SECONDS> <DURATION_SECONDS>

# Single frame snapshot
render.sh frame <IN> <ASS> <OUT_PNG> <TIMESTAMP_SECONDS>

Import

# Run directly:
bash render.sh input.mp4 captions.ass output.mp4

# FFmpeg invocation (full mode):
ffmpeg -y -v error -i "$IN" -vf "ass=$ASS" \
  -c:v libx264 -preset veryfast -crf 20 -c:a copy "$OUT"

# FFmpeg invocation (preview mode):
ffmpeg -y -v error -i "$IN" -ss "$START" -t "$DUR" -vf "ass=$ASS" \
  -c:v libx264 -preset veryfast -crf 20 -c:a copy "$OUT"

# FFmpeg invocation (frame mode):
ffmpeg -y -v error -i "$IN" -ss "$TIME" -vf "ass=$ASS" -frames:v 1 "$OUT"

I/O Contract

Inputs

Name Type Required Description
IN str (file path) Yes Input video file (e.g. input.mp4)
ASS str (file path) Yes ASS subtitle file from gen_ass
OUT str (file path) Yes Output video or image path
START str (seconds) No Start time for preview mode (e.g. 10)
DUR str (seconds) No Duration for preview mode (e.g. 5)
TIME str (seconds) No Timestamp for frame snapshot mode (with frame subcommand)

Outputs

Name Type Description
output.mp4 Video file (full mode) Final video with burned-in karaoke captions, H.264 encoded, audio passthrough
preview.mp4 Video file (preview mode) Short segment with burned-in captions for visual verification
frame.png Image file (frame mode) Single frame snapshot at timestamp with captions rendered

Usage Examples

Full Video Render

# Burn captions into the full video
bash render.sh input.mp4 captions.ass output.mp4

# Output: rendered -> output.mp4

Preview Segment for Visual Check

# Render a 5-second preview starting at 10 seconds
bash render.sh input.mp4 captions.ass preview.mp4 10 5

# Quick check: does the highlight sweep look right?

Single Frame Snapshot

# Extract a single frame at 12.5 seconds to check caption appearance
bash render.sh frame input.mp4 captions.ass frame.png 12.5

# Output: frame snapshot -> frame.png

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment