agnostic-skills

video-trim

video-trim

Cut the dead time out of a screen recording, crop it to the app, and hand over a short video that still lines up with your logs.

Quick start

  1. Copy the folder into your harness: install a skill.

  2. Check the tools are found:

    ffmpeg -version && ffprobe -version
  3. Trim a recording:

    python3 <skill>/scripts/trim.py video/run.mp4   # -> video/run-trimmed.mp4 + .trimmap.txt

What's inside

Script / fileWhat it does
scripts/app_crop.pyFind the app's rectangle in a larger capture and crop to it
scripts/trim.pyCut frozen stretches, keep a beat at each edge
scripts/cut_windows.pyKeep explicit or log-driven windows
scripts/scrub_overlays.pyCut notification banners (OCR; ocr_frames.swift is the macOS Vision helper)
scripts/ocr_frames.swiftmacOS Vision OCR helper behind scrub_overlays.py --ocr vision
scripts/side_by_side.pySlowed before/after of a sub-second effect
scripts/frame_strip.pyContact sheet to check a cut
scripts/stitch.pyJoin recordings into one review video with chapters
config.example.envOptional settings, commented

How it works

Order: scrub, then crop and trim (one encode), then check a frame strip, then stitch if you need one file.

Every script writes a new file and refuses to overwrite without --force. The trimmed copy carries a source-time subtitle track and a segment map, so a moment in the short video matches a log line.

Crop to the app
  • On by default in trim.py and cut_windows.py. The verdict is printed and written to the trimmap or segments file.

  • An app-only phone recording is detected and left alone.

  • Unclear cases (two windows, a lone small animation) exit 3 and never guess. Pass --crop W:H:X:Y or --no-crop.

  • Look at <out>.crop-before.png and <out>.crop-after.png before sharing.

  • Keep the full frame only when the surroundings are the evidence, and say so.

Configuration
KeyDefaultMeaning
VIDEO_TRIM_CROPautooff keeps the full frame by default; --crop still works
VIDEO_TRIM_CACHE~/.cache/video-trimFolder for the compiled macOS OCR helper

Set them in the environment or in ~/.config/video-trim/config.env. The environment wins.

Requirements
  • python3 3.9+, standard library only.

  • ffmpeg and ffprobe on PATH.

  • OCR for scrub_overlays.py only: macOS Vision (needs swiftc) or tesseract on any OS.

  • No network access.

Safety and uninstall
  • Inputs are never modified, except scrub_overlays.py --in-place (the source is the leak).

  • Nothing is written outside the outputs you name and the OCR cache folder.

  • No hooks to remove. Delete the skill folder and the cache folder.

  • Keep the original until the work is done.

Limits and traps
  • A held result screen is cut to about 0.6 s. Use cut_windows.py when it is the evidence.

  • A small idle animation or an animated background can defeat freeze detection.

  • Do not trim a timing capture.

  • Say in the hand-over that the video is trimmed and cropped.

  • Write <name>.start when recording starts, or a cut video cannot be lined up with a log.

  • Tesseract is less proven than Vision on real banners: dry-run first.

Files

Part of agnostic-skills · MIT