Advanced
Command line and automation
The same engine without the window, for batches, scripts and AI assistants.
2 min read
Everything the interface does, the command line does — because they call the
same code. The core of anYTrim has no dependency on the user interface at
all, which is what makes this possible rather than a parallel implementation
that drifts.
After installing, anytrim is on your PATH.
The commands
# What is installed, and where things are kept
anytrim info
# What a link offers, as JSON
anytrim formats "https://example.com/watch?v=..."
# Download
anytrim get "https://example.com/watch?v=..." --quality best
anytrim get "https://example.com/watch?v=..." --audio-only
# Clip a local file, or a URL
anytrim clip input.mkv --from 1:20 --to 1:45
anytrim clip "https://example.com/watch?v=..." --from 300 --to 345
# Where a lossless cut will really start
anytrim keyframes input.mkv --near 1:20
# What has been downloaded
anytrim history --limit 20
Every command takes --json, and with it writes one JSON object to stdout
and nothing else. That is the interface to script against: human-readable
output is allowed to change wording, JSON output is not.
A batch of links
Get-Content links.txt | ForEach-Object {
anytrim get $_ --quality best --json | ConvertFrom-Json
}
Ten clips from one file
0..9 | ForEach-Object {
$start = $_ * 45
anytrim clip source.mkv --from $start --to ($start + 45) --json
}
Checking before you cut
keyframes answers the question that makes lossless clipping predictable:
anytrim keyframes source.mkv --near 1:20 --json
# { "requested": 80.0, "keyframe": 78.4, "delta": -1.6 }
If delta matters for what you are doing, you know before you spend the
time, rather than discovering it in the output.
Using it with an AI assistant
anYTrim ships a Claude skill, so Claude can drive it directly: "download
this at 1080p and cut me three 30-second clips from the middle" becomes
real commands, with the JSON output read back. The skill and the two ways
to install it are in
the automation guide.
It works because of the JSON mode above — an assistant parsing human-readable
output is an assistant that breaks the first time a label is reworded.
Exit codes
| Code | Means |
|---|---|
0 |
Done |
1 |
The request was wrong — bad URL, unreadable file, impossible range |
2 |
A tool is missing; run anytrim info |
3 |
The download or cut failed; stderr says why |
Scripts should check the code and read error from the JSON. Both are
stable.
Found a mistake, or something unclear? These pages are markdown files in the repository — a pull request is welcome, or report it.