How p0gdog/vcompress works
Purpose and Entry Point
vcompress is a Rust command-line utility that compresses MP4 video files toward a user-selected size budget, with configurable audio bitrate or complete audio removal. The sole application entry point is src/main.rs; Cargo defines the buildable/installable binary through Cargo.toml.
CLI Boundary
src/main.rs owns command-line argument parsing and user-facing behavior: input video selection, output path override, target size in MB, audio bitrate, and no-audio mode. It derives a default output name such as example-compressed.mp4, separating invocation parameters from media-processing execution.
Paths: src/main.rs, Cargo.toml
Compression Planning
The application converts the requested target file size and audio settings into an FFmpeg encoding plan. The key architectural responsibility is allocating the file-size budget between audio and video, including the no-audio path, then selecting video encoding parameters that aim to meet the target.
Paths: src/main.rs
External Media Execution
Actual probing and transcoding are delegated to the system-installed FFmpeg executable rather than embedded Rust codecs. vcompress constructs and executes FFmpeg commands against local input/output files; FFmpeg availability on PATH is therefore a runtime prerequisite and an important failure boundary.
Paths: src/main.rs, README.md
Runtime and Platform Model
The binary runs locally as a native Rust CLI on supported desktop platforms, including Linux and Windows per the release/install guidance. It operates on local MP4 paths and has no server, database, browser, or persistent application state. Rust provides process orchestration; FFmpeg provides media codec/container handling.
Paths: Cargo.toml, src/main.rs, README.md
Distribution and Release
Cargo supports crates.io installation, while GitHub Actions provides CI and release automation. Release artifacts are intended for direct download, and Arch Linux packaging is maintained separately through a PKGBUILD. The release script likely coordinates the repository’s publishing/release workflow.
Paths: .github/workflows/ci.yml, .github/workflows/release.yml, scripts/release.sh, packaging/arch/PKGBUILD
Control Flow
Execution is linear: parse CLI input → resolve output filename and encoding settings → calculate bitrate/size targets → invoke FFmpeg on the local source → report command outcome. The principal boundary is process execution: invalid inputs, missing FFmpeg, unsupported media, or FFmpeg failures must be surfaced back through the CLI.
Paths: src/main.rs
Main entry points: main.rs CLI Entry Point · release.yml Release Workflow · Cargo.toml Cargo Package · release.sh Release Script
Components 13
Local Runtime
Native CLI processing on local MP4 files.
- Cargo Package · Defines the buildable and installable binary.
Cargo.toml - CLI Entry Point · Parses arguments and reports processing outcomes.
src/main.rs - Input MP4
- Output MP4
- Output Resolution · Derives or accepts the output filename.
src/main.rs - Encoding Plan · Allocates target size between audio and video, including no-audio mode.
src/main.rs - System FFmpeg · Probes and transcodes media through a PATH-installed process.
Distribution & Release
- CI Workflow
.github/workflows/ci.yml - Release Workflow
.github/workflows/release.yml - Release Script
scripts/release.sh - crates.io Install
Cargo.toml - Release Artifacts
- Arch Package
packaging/arch/PKGBUILD
Connections 14
- Cargo Package → CLI Entry Point: builds
- Input MP4 → CLI Entry Point: CLI input path
- CLI Entry Point → Output Resolution: resolves output
- CLI Entry Point → Encoding Plan: passes size and audio options
- Output Resolution → System FFmpeg: output path
- Encoding Plan → System FFmpeg: encoding arguments
- Input MP4 → System FFmpeg: source media
- System FFmpeg → Output MP4: transcoded MP4
- System FFmpeg → CLI Entry Point: process result or failure
- CI Workflow → Cargo Package: builds and validates
- Release Workflow → Release Script: runs
- Release Script → crates.io Install: publishes
- Release Workflow → Release Artifacts: creates
- Arch Package → Release Artifacts: packages release