Trim, compress, and highlight video clips with a clean, typed Python API.
FFmpeg binaries auto-downloaded on first use — no manual installation, no configuration.
No manual installation. On first use, clipflow detects your platform, downloads the
right binaries from trusted sources, and caches them locally. Windows, macOS, Linux — all supported.
TRIM
Lossless stream-copy
Default mode. -ss before -i for a fast keyframe seek. No
re-encoding, no quality loss, finished in seconds.
COMPRESS
CRF re-encode
Three named presets — COMPRESS_LOW / MEDIUM / HIGH — or
supply any CRF value and codec directly.
HIGHLIGHT ★
Highlight routing
Mark any ClipSpec with highlight=True. Finished clips are
copied to output/highlights/
automatically — no second encode.
ASPECT
Aspect ratio crop
Crop and pad to 16:9, 9:16, 1:1, 4:3, or any custom ratio. Centred crop,
even-dimension safe, applied as a single ffmpeg filter chain.
INSPECT
Video metadata
Duration, resolution, fps, codec, file size — returned as a typed VideoInfo dataclass via ffprobe.
Works on any format ffmpeg supports.
BATCH
Batch processing
Process multiple source files in one call via batch(), or drive it from a JSON
spec file with the CLI.
# All of these are equivalent01:30# MM:SS → 90 seconds00:01:30# HH:MM:SS → 90 seconds90# plain integer seconds90.5# fractional seconds# In Pythonparse_range("01:30", "02:00")parse_range(90, 120)parse_range("1:30", 120.0)# mixed ok
Reference
Compression presets.
COMPRESS_LOW
CRF28
Presetfast
Codeclibx264
Use casesmallest file
COMPRESS_MEDIUM
CRF23
Presetmedium
Codeclibx264
Use casebalanced (default)
COMPRESS_HIGH
CRF18
Presetslow
Codeclibx264
Use casebest quality
clipflow.trim() parameters
Parameter
Type
Default
Description
input_path
str | Path
required
Source video file path
clips
ClipSpec | list[ClipSpec]
required
One or more segments to extract
output_dir
str | Path
"output"
Destination directory, created automatically
on_progress
callable | None
None
Called after each clip: (idx, total, ClipResult) → None