A high-performance CLI tool for video compression with AMD GPU hardware acceleration support.
- AMD GPU Acceleration: Utilizes VAAPI for hardware-accelerated H.265 encoding
- Automatic Fallback: Falls back to software encoding if GPU acceleration fails
- Batch Processing: Compress multiple videos sequentially
- Configurable: YAML configuration with quality presets
- Progress Tracking: Real-time compression progress and statistics
- File Size Control: Target specific output file sizes
# Clone and build
git clone <repository>
cd videocompress
go build -o videocompress
# Or install directly
go install# Compress a single video
./videocompress /path/to/video.mp4
# Compress multiple videos
./videocompress /home/User/Videos/test.mp4 /home/User/Videos/test2.mp4 /home/User/Videos/test3.mp4
# Compress with custom target size
./videocompress -s 50M /path/to/video.mp4
# Compress multiple videos sequentially
./videocompress /path/to/videos/*.mp4Flags:
-s, --target-size string Target file size (e.g., 100M, 50MB) (default from config)
-c, --container string Output container format (mp4, mkv, webm) (default from config)
-q, --quality string Quality preset (low, medium, high, ultra) (default "medium")
-o, --output-dir string Output directory (default: same as input)
--config string Path to configuration file
-h, --help help for videocompress
Create a config.yaml file in your project directory or ~/.videocompress/config.yaml:
compression:
target_size: "100M"
container: "mp4"
audio_bitrate: "128k"
quality_presets:
low: 32
medium: 26
high: 20
ultra: 16
hardware:
vaapi_device: "/dev/dri/renderD128"
prefer_gpu: true
output:
suffix: "_compressed"
same_directory: true
directory: ""
ffmpeg:
path: "ffmpeg"
threads: 0- Required: AMD GPU with HEVC encoding support (RX 5000 series or newer recommended)
- Drivers: Mesa drivers with VAAPI support
- System: Linux with proper AMD GPU drivers installed
- FFmpeg: Must be installed and available in PATH
- Go: 1.19+ for building from source
./videocompress -s 100M /home/User/Videos/*.mp4./videocompress -q high video1.mp4 video2.mp4 video3.mp4./videocompress -o /home/User/compressed/ /home/User/Videos/*.mp4videocompress/
├── cmd/ # CLI commands and argument parsing
├── internal/
│ ├── config/ # Configuration management
│ ├── compressor/ # Core compression logic
│ ├── queue/ # Job queue and parallel processing
│ └── types/ # Shared type definitions
├── config.yaml # Default configuration
└── main.go # Application entry point
- AMD GPU VAAPI (Primary): Hardware-accelerated H.265 encoding
- Software H.265 (Fallback): CPU-based encoding using libx265
The tool automatically tries GPU acceleration first and falls back to software encoding if hardware acceleration fails or is unavailable.
The tool provides detailed output including:
- Real-time compression progress
- Method used (GPU/Software)
- File size reduction statistics
- Processing time per video
- Summary of successful and failed compressions
If GPU acceleration fails:
- Verify AMD GPU drivers are properly installed
- Check VAAPI device path (
/dev/dri/renderD128) - Ensure ffmpeg was compiled with VAAPI support
- The tool will automatically fall back to software encoding
- File not found: Verify input file paths are correct
- Permission denied: Ensure write permissions in output directory
- FFmpeg not found: Install ffmpeg and ensure it's in PATH
MIT License - see LICENSE file for details.