A utility for recompressing video files to x265 (HEVC) 10-bit format with optimized multi-core encoding.
recompress
automatically detects system resources and optimizes encoding settings for the best balance of quality and performance. It intelligently preserves all streams from the original file, including audio, subtitles, chapters, and metadata.
Features:
- Automatic detection and utilization of all available CPU cores
- High-quality x265 (HEVC) 10-bit encoding with customizable quality settings
- Automatic resolution scaling for videos exceeding specified dimensions (default is 1080p)
- Preservation of all streams (audio, subtitles, chapters, metadata, etc.)
- Smart detection of already-encoded HEVC files to avoid re-encoding
-
Clone this repository:
git clone https://github.com/EvanEdwards/recompress.git
-
Install to local user:
chmod +x recompress && mv recompress "$HOME/.local/share/bin/."
-
Install the manpage (optional, as --help also displays it):
recompress -M
- ffmpeg (with libx265 support)
- ffprobe
- pandoc (for help pages only)
Recompress a single video file:
recompress video.mp4
Recompress multiple video files:
recompress video1.mp4 video2.mp4 video3.mp4
Force recompression of already HEVC encoded files:
recompress -f video.mp4
By default, processed files are saved to the "_recompressed" directory in the current working directory. My personal workflow is to compress a bunch of files, check the quality and copy them down to the parent directory, overwriting the original.
Option | Description |
---|---|
-f, --force |
Force encoding even if the file is already in HEVC format |
-q, --quality VALUE |
Set the CRF quality value (18-35, lower is higher quality). Default is 26 |
-s, --speed PRESET |
Set the encoding speed preset. Options include: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow. Default is "slower" |
-x, --width WIDTH |
Set the maximum width for output videos. Videos wider than this will be scaled down while preserving aspect ratio. Default is 1920 |
-y, --height HEIGHT |
Set the maximum height for output videos. Videos taller than this will be scaled down while preserving aspect ratio. Default is 1080 |
-h, --help |
Display help information |
-M, --installmanpage |
Install the manpage to your local user manpage directory |
--, -- |
Signal the end of options; treat all subsequent arguments as files |
Set custom quality (lower values = higher quality) and speed preset:
recompress -q 22 -s medium video.mp4
Limit resolution to 720p:
recompress -x 1280 -y 720 video.mp4
- The script automatically utilizes all available CPU cores for encoding
- Audio, chapters, subtitles, and other streams are preserved in the output file
- Videos exceeding the maximum resolution (default 1920x1080) are scaled down while preserving aspect ratio
- The script skips files that are already in HEVC format unless -f/--force is used
MIT License - Copyright (c) 2025 Evan A. Edwards evan@cheshirehall.net
For more details, see the manpage:
man recompress # Install with: recompress -M