High-performance video cropping and trimming CLI tool with automatic detection
Project description
vexy-vid
High-performance video cropping and trimming CLI tool with automatic detection.
Features
- Crop — crop video to specific dimensions with alignment control
- Trim — remove edges from video (like reversed CSS padding)
- Scale — resize video after cropping/trimming
- Automatic letterbox (black bar) detection and removal
- Automatic subtitle region detection and removal
- Hardware-accelerated encoding with automatic fallback
- PyAV-based frame extraction (50-100% faster than OpenCV)
- Numba-optimized pixel analysis (10-50x speedup)
- Parallel frame processing with buffer pooling
Requirements
- Python 3.10+
- ffmpeg binary installed on your system (
brew install ffmpeg/apt install ffmpeg)
Note: ffmpeg is a system dependency and cannot be installed via pip. All other dependencies are installed automatically.
Installation
# Install with uv (recommended)
uv pip install vexy-vid
# Or with pip
pip install vexy-vid
# Development install
uv pip install -e ".[dev]"
Usage
Crop — crop to specific dimensions
# Crop to exact pixels
vexy-vid crop --crop 1280x720 --input video.mp4
# Crop to aspect ratio
vexy-vid crop --crop 16:9 --Halign 0 --Valign 100 --input video.mp4
# Crop to percentage
vexy-vid crop --crop 50%x50% --input video.mp4
# Crop and scale
vexy-vid crop --crop 16:9 --scale 1920x1080 --input video.mp4
Trim — remove edges
# Remove pixels from edges
vexy-vid trim --top 100 --bottom 50 --input video.mp4
# Remove percentage from sides
vexy-vid trim --left 10% --right 10% --input video.mp4
# Auto-detect and remove letterbox bars
vexy-vid trim --Letterbox --input video.mp4
# Auto-detect and remove subtitle region
vexy-vid trim --subtitles --bottom 20 --input video.mp4
# Trim and scale
vexy-vid trim --Letterbox --scale 1920x1080 --input video.mp4
Common flags
| Flag | Description |
|---|---|
--input / -i |
Input video path (or pipe via stdin) |
--output / -o |
Output video path (auto-generated if omitted) |
--quality / -q |
Encoding quality: 0 (fast), 1 (balanced), 2 (quality) |
--verbose / -v |
Enable verbose logging |
Size spec formats (for --crop and --scale)
| Format | Example | Description |
|---|---|---|
WxH |
1280x720 |
Exact pixel dimensions |
W:H |
16:9 |
Aspect ratio |
P%xP% |
50%x50% |
Percentage of original |
Wx |
1280x |
Width only (height = 100%) |
xH |
x720 |
Height only (width = 100%) |
| Mixed | 1280x50% |
Pixels and percentage |
Performance
Optimizations over the original implementation:
- PyAV multi-threaded decoding — 50-100% faster frame extraction
- Hardware encoder detection — 300-500% encoding speedup (NVENC, QSV, AMF)
- Producer-consumer pipeline — 200-400% parallel processing improvement
- Buffer pool memory management — 25-50% reduced allocation overhead
- Numba SIMD pixel operations — 10-50x analysis speedup
- Intelligent caching — instant reprocessing of identical videos
License
Project details
Release history Release notifications | RSS feed
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 vexy_vid-1.0.1.tar.gz.
File metadata
- Download URL: vexy_vid-1.0.1.tar.gz
- Upload date:
- Size: 21.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b984b987a0158e661476d0bbc737ceacea3bd030feddf8e4fe37029cc916b66
|
|
| MD5 |
4f54e9566a5eb213620f9eb03286f142
|
|
| BLAKE2b-256 |
ca5edaa54db7611cc2b2357ad0fad2a0eba18c3b32a543e25070b5e948ec1743
|
File details
Details for the file vexy_vid-1.0.1-py3-none-any.whl.
File metadata
- Download URL: vexy_vid-1.0.1-py3-none-any.whl
- Upload date:
- Size: 25.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4552d136ba388c43347a595912232d3b0d6ba71f8e1435c2ed4c1c3d1b3038e3
|
|
| MD5 |
ba83db77ea397a38de7880c7ff1a70b7
|
|
| BLAKE2b-256 |
afe1fde2bd2594e6a1c7150d68d95807ad712b9935325c3d5320224af0a013b3
|