A comprehensive Python-based video encoding application with hardware acceleration support, intelligent resolution scaling, and real-time progress monitoring.
- Automatic GPU Detection: Detects NVIDIA GeForce, AMD Radeon, and Intel integrated graphics
- Hardware Acceleration: Supports NVIDIA NVENC, AMD VCE, and Intel QuickSync
- Smart Codec Selection: Automatically selects the best encoder based on available hardware
- Fallback Support: Falls back to CPU-based encoding when hardware acceleration is unavailable
- Preset Resolutions: HD (720p), FHD (1080p), QHD (1440p), UHD (4K)
- Intelligent Scaling: Automatically downscales videos exceeding target resolution
- Aspect Ratio Preservation: Maintains original aspect ratio during scaling
- No Unnecessary Upscaling: Preserves smaller videos at their original resolution
- Quality-Based (CRF): Constant Rate Factor encoding for consistent quality
- Bitrate-Based (VBR): Variable bitrate encoding with customizable multipliers
- Quality Presets: Ultra High, High, Medium, Low, Very Low quality settings
- Custom Parameters: Fine-tune encoding settings for specific requirements
- Rich Terminal UI: Beautiful progress bars and real-time statistics
- Live Progress Tracking: Monitor encoding progress for each file
- Comprehensive Statistics: File sizes, compression ratios, encoding times
- Error Handling: Detailed error reporting and failed file management
- Python 3.8 or higher
- FFmpeg installed and accessible in PATH
- Supported video formats: MP4, AVI, MKV, MOV, WMV, FLV, WebM, M4V
-
Clone the repository:
git clone <repository-url> cd Auto-Encoder-Py
-
Install dependencies:
pip install -r requirements.txt
-
Install FFmpeg:
- Windows: Download from https://ffmpeg.org/download.html
- macOS:
brew install ffmpeg - Ubuntu/Debian:
sudo apt install ffmpeg
Run the application:
python main.pyFollow the interactive prompts to:
- Select target directory
- Choose maximum resolution preset
- Configure encoding method (CRF or VBR)
- Set processing options
from video_encoder import VideoEncoder
from resolution_handler import ResolutionPreset
from encoding_config import EncodingMethod
# Initialize encoder
encoder = VideoEncoder()
# Configure settings
encoder.set_resolution_preset(ResolutionPreset.FHD)
encoder.set_encoding_method(EncodingMethod.CRF, 23)
# Discover and encode files
video_files = encoder.discover_video_files("/path/to/videos")
results = encoder.encode_batch(video_files)The application is built using a modular architecture:
hardware_detector.py: GPU detection and hardware acceleration capability assessmentresolution_handler.py: Video resolution management and scaling calculationsencoding_config.py: Encoding configuration management (CRF/VBR)progress_display.py: Real-time progress monitoring with Rich UIvideo_encoder.py: Main encoding engine that orchestrates all componentsmain.py: Interactive application interface
HardwareDetector: Detects available GPUs and their encoding capabilitiesResolutionHandler: Manages target resolution and scaling operationsEncodingConfigManager: Handles encoding method configurationProgressDisplay: Provides real-time progress feedbackVideoEncoder: Main orchestrator for the encoding process
| Preset | Resolution | Description |
|---|---|---|
| HD | 1280×720 | HD (720p) - Standard definition |
| FHD | 1920×1080 | Full HD (1080p) - High definition |
| QHD | 2560×1440 | Quad HD (1440p) - Ultra high definition |
| UHD | 3840×2160 | Ultra HD (4K) - Maximum quality |
| GPU Vendor | Encoder | Codec Support |
|---|---|---|
| NVIDIA | NVENC | H.264, H.265/HEVC |
| AMD | VCE | H.264, H.265/HEVC |
| Intel | QuickSync | H.264, H.265/HEVC |
The application automatically detects your hardware and selects the best available encoder:
- NVIDIA NVENC (Priority 1) - Best performance and quality
- AMD VCE (Priority 2) - Good performance
- Intel QuickSync (Priority 3) - Decent performance
- Software (CPU) (Fallback) - Highest quality, slowest speed
- Range: 0-51 (lower = higher quality)
- Recommended: 18-28 for most content
- Use Case: When consistent quality is more important than file size
- Range: 0.1-10.0x multiplier of original bitrate
- Recommended: 0.5-1.0x for most content
- Use Case: When specific file sizes or bitrates are required
- Use Hardware Acceleration: Significantly faster encoding times
- Choose Appropriate CRF: CRF 23 provides good balance of quality and size
- Batch Processing: Process multiple files for efficiency
- SSD Storage: Use SSD for input/output files when possible
FFmpeg not found:
- Ensure FFmpeg is installed and in your system PATH
- Test with:
ffmpeg -version
Hardware acceleration not working:
- Check if your GPU supports hardware encoding
- Update GPU drivers to the latest version
- Some older GPUs may not support modern encoders
Out of memory errors:
- Reduce the number of concurrent encodings
- Use a lower resolution preset
- Close other applications to free up memory
Slow encoding speeds:
- Check if hardware acceleration is enabled
- Use faster encoding presets (may reduce quality)
- Ensure adequate cooling for sustained workloads
This project is licensed under the MIT License. See the LICENSE file for details.
- FFmpeg - Multimedia framework
- ffmpeg-python - Python FFmpeg wrapper
- Rich - Rich text and beautiful formatting
- GPUtil - GPU utilization library
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
If you encounter any issues or have questions, please open an issue on the GitHub repository.