adopt_video: ADOPT frames option to cut a clip short

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-10-14 22:24:03 +02:00
parent 052a56bc11
commit 31768ca41c

View File

@@ -11,9 +11,10 @@ Sidebar scenes (scene_*) are a slow loop in the game's left column instead: no
vignette and no in-between frames, but the same darkening towards the bottom the
still image had (MainForm.SceneBitmap), so it blends into the dark column.
Optional per clip, ADOPT = {name: {"tween": bool, "shade": 0..255}} in the project's
VIDEO_MODULE: tween=False keeps the 49 raw frames (slow loops, half the size), shade
darkens every frame by that alpha of black (to match a dimmed backdrop in the game).
Optional per clip, ADOPT = {name: {"tween": bool, "shade": 0..255, "frames": n}} in the
project's VIDEO_MODULE: tween=False keeps the 49 raw frames (slow loops, half the size), shade
darkens every frame by that alpha of black (to match a dimmed backdrop in the game), frames
keeps only the first n raw frames (cut a clip before it goes wrong).
Usage:
py -3.12 adopt_video.py every clip that has frames
@@ -86,9 +87,9 @@ def adopt(name):
os.makedirs(DEST, exist_ok=True)
for old in glob.glob(os.path.join(DEST, f"{name}_*.jpg")):
os.remove(old)
raw = [np.asarray(Image.open(f).convert("RGB")) for f in frames]
scene = name.startswith("scene_")
opts = ADOPT.get(name, {})
raw = [np.asarray(Image.open(f).convert("RGB")) for f in frames[:opts.get("frames", len(frames))]]
scene = name.startswith("scene_")
if opts.get("tween", not scene):
raw = interpolate(raw)
size = (raw[0].shape[1], raw[0].shape[0])