Rust-based video encoding tool built on FFmpeg and x265/HEVC for batch processing with intelligent content analysis.
# Auto-detect content and encode
./ffmpeg-encoder -i input.mkv
# Specify profile and mode
./ffmpeg-encoder -i input.mkv -p anime -m crf
# Batch process directory
./ffmpeg-encoder -i /path/to/videos/ -p auto
# Strip Dolby Vision metadata (fast, no re-encode)
./ffmpeg-encoder -i input.mkv --strip-dolby-vision- Three encoding modes: CRF (quality), ABR (average bitrate), CBR (constant bitrate)
- HDR support: Dolby Vision (profiles 5, 7, 8.1, 8.2, 8.4) and HDR10+ with metadata preservation
- Metadata stripping: Fast removal of Dolby Vision or HDR10+ metadata without re-encoding (copy mode)
- Auto crop detection: Multi-sample temporal analysis with HDR/SDR-specific thresholds
- Stream preservation: Losslessly copies all audio, subtitles, chapters, and metadata
- 11 content-specific profiles: From anime to heavy grain 4K content
- Preview mode: Test encoding settings on frames or segments before full encode
- Processing filters: NNEDI3/yadif deinterlacing, hqdn3d denoising
Requirements:
- Rust 1.70+ with Cargo
- FFmpeg with libx265 support
- Optional:
dovi_tool(Dolby Vision),hdr10plus_tool(HDR10+),mkvmerge(from mkvtoolnix)
Linux/macOS:
git clone https://github.com/user/ffmpeg_autoencoder_rust.git
cd ffmpeg_autoencoder_rust
# Production build (optimized, recommended)
./build.sh production
# Or development build (faster compile, includes debug symbols)
./build.sh devWindows:
git clone https://github.com/user/ffmpeg_autoencoder_rust.git
cd ffmpeg_autoencoder_rust
REM Production build (optimized, recommended)
build.bat production
REM Or development build (faster compile, includes debug symbols)
build.bat devManual build (all platforms):
# Production build
cargo build --release
# Binary: target/release/ffmpeg-encoder
# Development build
cargo build
# Binary: target/debug/ffmpeg-encoderThe build scripts will check for required dependencies and provide helpful error messages if anything is missing.
# Auto mode (detects best profile)
./ffmpeg-encoder -i input.mkv
# Specific profile
./ffmpeg-encoder -i input.mkv -p anime -m crf
# Batch processing
./ffmpeg-encoder -i /videos/ -p auto
# Custom output path
./ffmpeg-encoder -i input.mkv -o /output/path.mkvTest encoding settings before processing the full file. Simply use --preview-time or --preview-range to automatically enter preview mode:
# Generate single frame preview image at 60s
./ffmpeg-encoder -i input.mkv -p anime --preview-time 60
# Generate 10-second video segment preview (30s-40s)
./ffmpeg-encoder -i input.mkv -p anime --preview-range 30-40
# Compare multiple profiles with a preview profile group
./ffmpeg-encoder -i input.mkv --preview-time 60 --preview-profile anime_comparisonPreview options:
--preview-time <SECONDS>- Generate a single frame image at the specified timestamp--preview-range <START-END>- Generate a video segment from start to end time (e.g., "30-40")--preview-profile <NAME>- Test multiple encoding profiles simultaneously for comparison
Preview outputs are saved as {UUID}_preview_{profile}_{timestamp}.{ext} in the same directory as the input file.
Strip Dolby Vision or HDR10+ metadata without re-encoding. This operation is very fast (seconds instead of hours) as it simply copies all streams and removes the specified metadata:
# Strip Dolby Vision metadata (keeps base HDR10)
./ffmpeg-encoder -i "Dolby Vision Movie.mkv" --strip-dolby-vision
# Strip HDR10+ dynamic metadata (keeps base HDR10)
./ffmpeg-encoder -i "HDR10+ Movie.mkv" --strip-hdr10-plus
# With custom output
./ffmpeg-encoder -i input.mkv --strip-dolby-vision -o output.mkv
# Batch process entire directory
./ffmpeg-encoder -i /movies/ --strip-dolby-visionWhat gets stripped:
--strip-dolby-vision: Removes Dolby Vision RPU data and configuration records--strip-hdr10-plus: Removes HDR10+ dynamic metadata (SEI messages)
What gets preserved:
- Base HDR10 static metadata (master display, max content light level)
- All video streams (copied, not re-encoded)
- All audio streams
- All subtitle streams
- Chapters and attachments
Note: You cannot use both flags simultaneously - choose one based on your source content.
# Legacy interlaced content
./ffmpeg-encoder -i old_dvd.avi --deinterlace -p classic_anime
# Heavy grain with denoising
./ffmpeg-encoder -i grainy_film.mkv --denoise -p heavy_grain
# CBR for streaming
./ffmpeg-encoder -i input.mkv -p movie -m cbrView available profiles:
./ffmpeg-encoder --list-profiles
./ffmpeg-encoder --show-profile animeContent-optimized profiles:
movie,movie_mid_grain,movie_size_focused- Live-action filmsheavy_grain- High-grain preservationanime,classic_anime- 2D animation3d_cgi,3d_complex- 3D animated content4k,4k_heavy_grain- 4K contentauto- Automatic profile selection
Control which audio/subtitle streams to include:
# English only
./ffmpeg-encoder -i input.mkv -s english_only
# Multiple languages
./ffmpeg-encoder -i input.mkv -s multilang
# View available profiles
./ffmpeg-encoder --list-stream-profilesThe app automatically searches for config.yaml in this order:
- Path specified via
--config(if provided) config/subdirectory next to the binary- User config directory:
~/.config/ffmpeg-encoder/(Linux),~/Library/Application Support/ffmpeg-encoder/(macOS),%APPDATA%\ffmpeg-encoder\(Windows) - Falls back to embedded default configuration
Key settings:
- Tool paths: FFmpeg, FFprobe, dovi_tool, hdr10plus_tool, mkvmerge
- Analysis: Crop detection thresholds, HDR/Dolby Vision handling
- Filters: Deinterlacing (NNEDI3/yadif), denoising (hqdn3d)
- Profiles: Custom encoding profiles with x265 parameters
- Preview profiles: Define comparison groups for preview mode
- Stream selection: Audio/subtitle filtering rules
Validate your config:
./ffmpeg-encoder --validate-configThe tool automatically detects and handles HDR content:
- HDR10: Preserves static HDR metadata
- HDR10+: Extracts and re-injects dynamic metadata using
hdr10plus_tool - Dolby Vision: Converts profiles for compatibility (e.g., Profile 7 → 8.1), preserves RPU data using
dovi_tool
All HDR processing is automatic - just encode as normal. The tool applies appropriate bitrate and CRF adjustments per profile.
File naming:
- Auto-generated:
{original_filename}_{UUID}.{ext}(prevents conflicts, preserves original name) - Custom: Use
-oflag - Logs:
{original_filename}_{UUID}.logwith detailed encoding information
Progress display: Real-time progress bar with FPS, speed, ETA, and file size estimates.
# List available profiles
./ffmpeg-encoder --list-profiles
# Show profile details
./ffmpeg-encoder --show-profile anime
# Validate configuration
./ffmpeg-encoder --validate-config
# View all available options
./ffmpeg-encoder --helpCustom configuration:
./ffmpeg-encoder --config /path/to/custom.yaml -i input.mkvLogging:
# Verbose output
./ffmpeg-encoder -i input.mkv -v
# Debug output
./ffmpeg-encoder -i input.mkv --debugArchitecture:
- Async I/O with Tokio
- Type-safe configuration (Serde YAML)
- Multi-pass encoding for ABR/CBR
- Unified content analysis pipeline
- Comprehensive error handling with context
Processing pipeline:
- Content analysis (resolution, HDR detection, crop detection)
- Profile selection (auto or manual)
- Stream mapping (audio/subtitle filtering)
- Encoding (CRF/ABR/CBR with x265)
- HDR metadata processing (Dolby Vision/HDR10+)
- Output verification and logging
MIT License - see LICENSE file for details.