manus-skills/.kortix/opencode/skills/media/clipify/scripts/build_pan.py
zhukang 1c7abd81d1 All 310 Manus skill-hub community skills as a Kortix marketplace registry
- 310 registry:skill items, 1528 files, 7 categories (hub tags)
- registry.json generated by @kortix/registry buildRegistry
- nested SKILL.md in sn-da-* renamed SUBSKILL.md (no phantom skills)
- provenance + licenses: SOURCES.md
2026-09-15 13:37:20 +08:00

19 lines
524 B
Python

#!/usr/bin/env python3
"""Build ffmpeg crop x-expression for hard-cut speaker pan.
Usage: build_pan.py SEGMENTS.json LEFT_X RIGHT_X
Stdout: ffmpeg expression suitable for crop=W:H:x='EXPR':y=0
"""
import json, sys
segs = json.load(open(sys.argv[1]))
LEFT_X = int(sys.argv[2])
RIGHT_X = int(sys.argv[3])
def x_for(s): return LEFT_X if s == "left" else RIGHT_X
expr = str(x_for(segs[-1]["speaker"]))
for seg in reversed(segs[:-1]):
expr = f"if(lt(t\\,{seg['end']:.4f})\\,{x_for(seg['speaker'])}\\,{expr})"
print(expr)