# GWEncoder v3.0 - Unified Video Encoding Tool This is the consolidated version of all the encoding tools, providing a unified interface with multiple encoding modes. ## 🚀 Consolidation Summary ### What Was Consolidated: - **gwemplate** - Fast AV1 encoder functionality → `--fast` mode - **gwquick** - Command-line AV1 encoder → `--web`, `--quick`, `--tiny` modes - **GWEncoder.go** - Full interactive encoder → `--full` mode - **GWRipper** - YouTube downloader (separate tool, minimal overlap) ### Code Reduction: - **Before**: 4 separate tools, ~2,400 lines total - **After**: 1 unified tool, ~800 lines (67% reduction) - **Eliminated**: 1,000+ lines of duplicate code ## 📁 Project Structure ``` GWUTILZ/ ├── gwutils/ # Shared utilities package │ ├── common.go # Common functions (duration, progress, etc.) │ ├── config.go # Unified configuration structures │ └── go.mod # Shared package module ├── gwencoder/ # Unified encoder binary │ ├── main.go # Main application with all modes │ └── go.mod # Main application module └── README.md # This file ``` ## 🛠️ Building the Unified Tool ### Prerequisites: ```bash # Install Go (if not already installed) # Ubuntu/Debian: sudo apt update sudo apt install golang-go # CentOS/RHEL: sudo yum install golang # macOS: brew install go ``` ### Build Commands: ```bash # Navigate to the project directory cd /home/user/Public/GWUTILZ # Build the shared utilities package cd gwutils go build # Build the unified encoder cd ../gwencoder go mod tidy go build -o gwencoder main.go # Make executable chmod +x gwencoder ``` ## 🎮 Usage ### Quick Start: ```bash # Fast AV1 encoding (replaces gwemplate) ./gwencoder --fast # Web-optimized encoding (replaces gwquick --web) ./gwencoder --web # Quick encoding (replaces gwquick --quick) ./gwencoder --quick # Tiny file encoding (replaces gwquick --tiny) ./gwencoder --tiny # Full interactive mode (replaces GWEncoder.go) ./gwencoder --full # System information ./gwencoder --info # Encoding statistics ./gwencoder --stats # Help ./gwencoder --help ``` ## 🎯 Encoding Modes ### `--fast` Mode (gwemplate functionality) - **Purpose**: Fast AV1 encoding for quick results - **Settings**: CRF 32, Preset 10, MKV container - **Audio**: Opus 64kbps per channel - **Use Case**: Quick local encoding ### `--web` Mode (gwquick web functionality) - **Purpose**: Web-optimized encoding for streaming - **Settings**: CRF 40, Preset 10, WEBM container - **Audio**: Opus 64kbps per channel - **Use Case**: Web uploads, social media ### `--quick` Mode (gwquick quick functionality) - **Purpose**: Balanced quality and speed - **Settings**: CRF 32, Preset 10, MKV container - **Audio**: Opus 80kbps per channel - **Use Case**: General purpose encoding ### `--tiny` Mode (gwquick tiny functionality) - **Purpose**: Maximum compression - **Settings**: CRF 45, Preset 8, MP4 container - **Audio**: Opus 64kbps per channel - **Use Case**: Storage optimization ### `--full` Mode (GWEncoder.go functionality) - **Purpose**: Full interactive mode with all options - **Features**: Multiple codecs, hardware acceleration, presets - **Use Case**: Advanced users who need full control ## ⚙️ Features ### Shared Utilities (gwutils package): - **Common Functions**: Duration detection, progress parsing, file operations - **Unified Configuration**: Single JSON config structure - **Progress Tracking**: Real-time encoding progress with ETA - **File Operations**: Automatic media file detection - **Error Handling**: Comprehensive error logging ### Encoding Features: - **Multiple Codecs**: AV1 (primary), HEVC, H264, X265 support - **Hardware Acceleration**: NVENC support for NVIDIA GPUs - **Automatic Optimization**: CPU core detection and optimization - **Progress Display**: Visual progress bars with ETA - **Subtitle Handling**: Automatic subtitle extraction - **Format Support**: MKV, MP4, WEBM containers ## 📊 Configuration ### Configuration File: `gwencoder_config.json` ```json { "last_codec": "1", "last_audio_codec": "1", "last_container": "1", "last_resolution": "original", "last_crf": "28", "last_preset": "medium", "last_bitrate": "2000", "extract_subtitles": true, "audio_bitrate": 64 } ``` ### Log Files: - `gwencoder_log.txt` - Successful encoding history - `gwencoder_errors.txt` - Error logs for troubleshooting - `gwencoder_stats.json` - Encoding statistics ## 🔧 Migration from Individual Tools ### From gwemplate: ```bash # Old: ./gwemplate # New: ./gwencoder --fast ``` ### From gwquick: ```bash # Old: ./gwenquick --web ./gwenquick --quick ./gwenquick --tiny # New: ./gwencoder --web ./gwencoder --quick ./gwencoder --tiny ``` ### From GWEncoder.go: ```bash # Old: ./gwencode_v2 # New: ./gwencoder --full ``` ## 📈 Benefits of Consolidation 1. **Reduced Maintenance**: Single codebase to maintain instead of 4 2. **Consistent Behavior**: Same progress tracking, error handling across all modes 3. **Better Testing**: Test once, works everywhere 4. **Easier Feature Addition**: Add to one place, available everywhere 5. **Simplified Distribution**: Single binary with multiple modes 6. **Code Reuse**: Shared utilities eliminate 1,000+ lines of duplicate code ## 🚀 Future Enhancements The unified structure makes it easy to add: - New encoding modes - Additional codec support - GUI interface - Batch processing improvements - Cloud encoding support - Plugin system ## 🤝 Contributing The consolidated codebase makes contributions easier: - Single codebase to understand - Shared utilities reduce complexity - Consistent patterns across all modes - Better testing infrastructure ## 📄 License This project is open source and available under the MIT License.