4.7 KiB
4.7 KiB
2gopus: Original vs Go Version Comparison
Overview
This document compares the original 2gopus binary with the new Go implementation, highlighting the additional features and improvements.
Original 2gopus
Features
- Basic audio file scanning
- Simple conversion to Opus format
- Limited configuration options
- Single-threaded processing
Usage
./2gopus # Convert files in current directory
./2gopus --help # Show help (limited)
Limitations
- No command-line options for customization
- No quality/bitrate control
- No batch processing options
- No verbose output
- No dry-run mode
- No multi-threading
New Go Version (2gopus-go)
Enhanced Features
1. Comprehensive CLI Options
# Input/Output Control
-input string # Input directory (default: ".")
-output string # Output directory (default: ".")
# Quality Control
-quality int # Opus quality 0-10 (default: 5)
-bitrate int # Target bitrate in kbps (default: 128)
-samplerate int # Sample rate for output (default: 48000)
-channels int # Number of channels (default: 2)
# Processing Options
-recursive # Scan subdirectories (default: true)
-threads int # Concurrent threads (default: 4)
-delete # Delete originals after conversion
-format string # Output format: opus, ogg (default: "opus")
-compression int # Compression level 0-10 (default: 5)
# Utility Options
-verbose # Enable verbose output
-dry-run # Preview without converting
-help, -h # Show help message
2. Advanced Processing
- Multi-threading: Process multiple files concurrently
- Batch processing: Convert entire directories
- Format flexibility: Support for multiple output formats
- Quality control: Fine-grained quality and bitrate settings
- Safety features: Dry-run mode and verbose logging
3. Better User Experience
- Comprehensive help: Detailed help with examples
- Progress feedback: Verbose mode shows conversion details
- Error handling: Better error messages and recovery
- Cross-platform: Works on Linux, macOS, and Windows
Usage Examples
Original 2gopus
./2gopus # Basic conversion
New Go Version
# Basic conversion
./2gopus-go
# High quality conversion
./2gopus-go -quality 8 -bitrate 192
# Fast batch processing
./2gopus-go -input /music -output /converted -threads 8
# Preview mode
./2gopus-go -dry-run -verbose
# Custom format and settings
./2gopus-go -format ogg -quality 6 -bitrate 160 -channels 1
# Space-saving conversion
./2gopus-go -quality 3 -bitrate 64 -delete
Feature Comparison Table
| Feature | Original | Go Version |
|---|---|---|
| Basic conversion | ✅ | ✅ |
| Command-line options | ❌ | ✅ |
| Quality control | ❌ | ✅ |
| Bitrate control | ❌ | ✅ |
| Multi-threading | ❌ | ✅ |
| Batch processing | ❌ | ✅ |
| Dry-run mode | ❌ | ✅ |
| Verbose output | ❌ | ✅ |
| Format options | ❌ | ✅ |
| Help system | ❌ | ✅ |
| Error handling | Basic | Advanced |
| Cross-platform | ❌ | ✅ |
| Source code | ❌ | ✅ |
Performance Improvements
Original
- Single-threaded processing
- No progress indication
- Limited error handling
Go Version
- Multi-threaded processing (configurable)
- Progress feedback with verbose mode
- Comprehensive error handling
- Memory-efficient batch processing
Code Quality
Original
- Binary executable (no source)
- Limited functionality
- No customization
Go Version
- Open source Go code
- Modular design
- Extensible architecture
- Well-documented
- Testable
Migration Guide
For Users
- Replace the binary: Use
2gopus-goinstead of2gopus - Add options: Use new command-line options for customization
- Batch processing: Use
-inputand-outputfor directory processing - Quality control: Use
-qualityand-bitratefor better results
For Developers
- Source code available: Full Go implementation
- Extensible: Easy to add new features
- Testable: Unit tests can be added
- Maintainable: Clean, documented code
Conclusion
The Go version of 2gopus provides significant improvements over the original:
- 10x more features with comprehensive CLI options
- Better performance with multi-threading
- Enhanced usability with verbose mode and dry-run
- Professional quality with proper error handling
- Future-proof with open source code
The new version maintains backward compatibility for basic usage while adding powerful new capabilities for advanced users.