Skip to main content

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-human must 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 stderr during analysis (every 5% for known-length videos).
  • For automation, set the environment variable ANALYZER_PROGRESS_JSON=1 to receive machine-readable progress messages on stderr.

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

vtrim-0.1.3.tar.gz (6.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vtrim-0.1.3-py3-none-any.whl (6.0 MB view details)

Uploaded Python 3

File details

Details for the file vtrim-0.1.3.tar.gz.

File metadata

  • Download URL: vtrim-0.1.3.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

Hashes for vtrim-0.1.3.tar.gz
Algorithm Hash digest
SHA256 8d65b6cbd95116eaeec9592876406af6b48e84b0dbc55f463b1c91ee44946b8b
MD5 3825d0eb660ce5c10b2b727efa4ddd4f
BLAKE2b-256 b41569bfbc86a7e98bdb5351ccab21d7a0b107a81b2bc1d1f521ca56ca175482

See more details on using hashes here.

File details

Details for the file vtrim-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: vtrim-0.1.3-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

Hashes for vtrim-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a415e6139cf0784661dd45954aacb34c165c8e7507f612eb6b3a24606dcba3da
MD5 1ab9a568a372b55ba69de9a1a045a1f4
BLAKE2b-256 ebe08e074440d36b66523369ba7a5028798f7f005388adfb857fce5d320e3a04

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page