Trim detects people in videos and trims segments—without re-encoding—preserving quality and speed.
Project description
VTrim
VTrim is a lightweight, efficient video analysis and trimming tool. It automatically finds segments containing people and can output a trimmed video instantly—without re-encoding, preserving original quality at blazing speed.
• ⚡ Lossless • 🎥 Professional edit-ready XML
Installation
Install via pip:
pip install vtrim
Quick Start
Trim Video Directly
vtrim --input your_video.mp4 --detect-human --output output.mp4
- Uses FFmpeg stream copy (-c copy) → no re-encoding, no quality loss.
- Automatically merges nearby detections and adds padding for smooth transitions.
Export Edit Timeline to DaVinci Resolve / Premiere Pro
Preserve the full timeline (including gaps) as an FCP7 XML for professional editing:
vtrim --input your_video.mp4 --detect-human --export-xml timeline.xml
Audio and video are perfectly synchronized and split per segment.
You can combine both outputs:
vtrim --input your_video.mp4 \
--detect-human \
--output output.mp4 \
--export-xml timeline.xml
Get Raw Detection Results (JSON)
Print detected time segments to stdout for scripting or integration:
vtrim --input meeting.mp4 --detect-human
Output:
{
"segments": [
{ "start": 2.3, "end": 5.8 },
{ "start": 10.1, "end": 14.7 }
]
}
Segments are in seconds, ready for automation (e.g., with Python, Node.js, or shell scripts).
Full Option Reference
| Parameter | Required | Description |
|---|---|---|
--input |
Yes | Path to the input video file (e.g., video.mp4). |
--detect-human |
No* | Enable human detection. If omitted, the tool returns an empty segment list and does nothing. (Required if you want analysis or trimming) |
--output |
No | Path to save the trimmed video (e.g., trimmed.mp4). If not provided, only JSON results are printed to stdout. |
--export-xml |
No | Path to save the FCP7 XML. |
--conf-threshold |
No | Confidence threshold for person detection (0.0–1.0). Lower = more sensitive. Default: 0.5. |
--padding |
No | Seconds of padding added before/after each detected segment. Default: 0.5. |
--gap-tolerance |
No | Maximum gap (in seconds) between detections to merge into one segment. Default: 1.0. |
📌 Important:
--detect-humanmust be specified to perform any analysis. Without it, the output will always be{"segments": []}.
Notes
- The underlying model is YOLOv8n (ONNX format), optimized for CPU inference.
- Video trimming uses FFmpeg stream copy (
-c copy), so it’s fast and lossless—no quality degradation. - Progress updates are printed to
stderrduring analysis (every 5% for known-length videos). - For automation, set the environment variable
ANALYZER_PROGRESS_JSON=1to receive machine-readable progress messages onstderr.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vtrim-0.1.4.tar.gz.
File metadata
- Download URL: vtrim-0.1.4.tar.gz
- Upload date:
- Size: 6.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
109e1b42c801cb45e142df4e6151acbe252e01e7dbb1ced9d6f95a4839485893
|
|
| MD5 |
ded4cb1a6034f4014e3dc21ffb9235b1
|
|
| BLAKE2b-256 |
712bf45855c7b27d3deeca39bc32cb119f42399a9c05597b755f885c52fcbbc2
|
File details
Details for the file vtrim-0.1.4-py3-none-any.whl.
File metadata
- Download URL: vtrim-0.1.4-py3-none-any.whl
- Upload date:
- Size: 6.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59635ff86142e5452076d7a50a5488f46a1976c3285c6be89c98e18d2ec2690f
|
|
| MD5 |
58ffa09cc768286397c1f6c81adf85fb
|
|
| BLAKE2b-256 |
06880d8e3fdd576ca46ad5a7600caa2c8a963b198b55651ac570ff8c769ef3cd
|