Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from bundle
Build or revise a reusable FFmpeg timeline for short-form video editing. Use when the user wants an agent-editable API for trimming clips, cropping, fitting to
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/timeline-template.py
1from pathlib import Path23if "project" not in globals():4import subprocess5import sys67# Point this at the local skill checkout or installed skill directory.8SKILL_SCRIPTS = Path("/absolute/path/to/video-timeline-editor/scripts")9SKILL_ROOT = SKILL_SCRIPTS.parent1011if __name__ == "__main__":12command = ["uv", "run", "--project", str(SKILL_ROOT), "video-timeline", "--timeline", __file__, *sys.argv[1:]]13raise SystemExit(subprocess.call(command))1415sys.path.insert(0, str(SKILL_SCRIPTS))16from video_timeline_editor import captions, clip, contain, cover, crop_box, project, text_overlay, transform1718# `PROJECT_DIR`, `project`, `clip`, `cover`, `contain`, `crop_box`,19# `transform`, `text_overlay`, and `captions` are injected by the engine.20# Save this file inside the video project's own working folder.21# Keep clips/, transcripts/, and final/ next to it.22BASE = PROJECT_DIR2324PROJECT = project(25width=1080,26height=1920,27fps=30,28background="black",29output=BASE / "final" / "edit.mp4",30work_dir=BASE / "final" / "timeline-render",31overlay_styles={32"topic": {33"fontsize": 42,34"fontcolor": "white",35"box": 1,36"boxcolor": "[email protected]",37"boxborderw": 16,38"x": "(w-text_w)/2",39"y": "120",40},41},42caption_styles={43"karaoke": {44"fontsize": 52,45"margin_v": 320,46},47},48)4950CONTENT_ID_SOFT = transform(51hflip=True,52zoom=1.08,53video_pts=0.93,54audio_tempo=1.075,55eq={56"brightness": 0.03,57"contrast": 1.05,58"saturation": 0.90,59},60)6162TIMELINE = [63clip(64id="hook",65label="Open strong",66source=BASE / "clips" / "hook.mp4",67take=(0.0, 4.8),68trim=(0.2, 0.0),69fit=cover(anchor="center"),70transform=CONTENT_ID_SOFT,71overlays=[72text_overlay("THE SHIFT", style="topic"),73],74captions=captions(75BASE / "clips" / "hook.elevenlabs.transcript.json",76trim="word",77),78),79clip(80id="response",81label="Avatar response",82source=BASE / "clips" / "avatar.mp4",83trim=(0.0, 0.8),84speed=1.05,85crop=crop_box(0.08, 0.00, 0.84, 1.00),86fit=contain(background="black"),87captions=captions(88BASE / "clips" / "avatar.elevenlabs.transcript.json",89trim="free",90replacements={"ACMEAI": "Acme AI"},91),92),93]94