- Python 3.7+ - Download from python.org
- Operating System: Windows 10+, macOS 10.14+, or Linux (any modern distribution)
- Disk Space: ~50MB for the application + space for video processing
- Memory: 4GB RAM recommended for smooth video processing
The system uses external tools for video processing. Install the ones you need:
- Download: mkvtoolnix.download
- Purpose: MKV file analysis, subtitle extraction, and video merging
- Installation:
- Windows: Use the installer, ensure "Add to PATH" is checked
- macOS: Use Homebrew (
brew install mkvtoolnix) or download DMG - Linux: Use package manager (
sudo apt install mkvtoolnixor equivalent)
- Download: ffmpeg.org
- Purpose: Subtitle format conversion (SRT/VTT โ ASS)
- Installation:
- Windows: Download static build, add to PATH manually
- macOS: Use Homebrew (
brew install ffmpeg) - Linux: Use package manager (
sudo apt install ffmpeg)
- Download: aegisub.org
- Purpose: Professional subtitle editing and advanced styling
- Installation: Standard installer for your platform
Test that tools are properly installed:
# Test MKVToolNix
mkvinfo --version
mkvextract --version
mkvmerge --version
# Test FFmpeg
ffmpeg -version
ffprobe -version
# Test Aegisub (optional)
aegisub --versionmkdir Universal_Subtitle_Processor
cd Universal_Subtitle_ProcessorSave each of the following files in your project directory:
video_processor_base.py- Abstract interface for all video processorsmkv_processor.py- MKV file format handlervideo_processor_factory.py- Format selection and managementuniversal_video_processor.py- Universal format interfacefile_utils.py- File management utilitiessubtitle_processor.py- Subtitle styling engineaegisub_processor.py- Manual editing integrationgui.py- Drag & drop GUI interfacemain.py- Launcher
subtitle_config.json- Your styling configurationrequirements.txt- Python dependencieslaunch_gui.bat- Windows launcher scriptlaunch_gui.sh- Linux/macOS launcher script
README.md- This setup guideCONFIGURATION_GUIDE.md- Detailed styling and config helpEXTENDING_THE_SYSTEM.md- How to add new video format support
pip install tkinterdnd2Or use the requirements file:
pip install -r requirements.txtpython main.py --helpShould show the command-line help without errors.
- Double-click
main.pyto launch the GUI - Select your config file: Click "Browse" and choose
subtitle_config.json - Drag and drop files: Drop MKV files or entire folders onto the interface
- Start processing: Click "Start Processing" and watch the magic happen!
# Basic processing with your config
python main.py movie.mkv -c subtitle_config.json --no-manual
# Process with manual Aegisub styling
python main.py movie.mkv -c subtitle_config.json
# Specify output file and subtitle track
python main.py movie.mkv -o styled_movie.mkv -t 2 -c subtitle_config.json
# Quick styling without config file
python main.py movie.mkv --font-name "Arial" --font-size 24 --no-manual- Windows: Double-click
launch_gui.bat - Linux/macOS: Run
./launch_gui.shorbash launch_gui.sh
Your subtitle_config.json file controls how subtitles look. Here's what each parameter does:
{
"subtitle_style": {
"font_name": "Helvetica", // Font family name
"font_size": 22, // Size in points
"primary_color": "&H00FFFFFF", // Text color (white)
"secondary_color": "&H000000FF", // Secondary color (red)
"outline_color": "&H00000000", // Outline color (black)
"back_color": "&H80000000", // Background (semi-transparent black)
"bold": 1, // Bold text (0=off, 1=on)
"italic": 0, // Italic text (0=off, 1=on)
"outline": 1.0, // Outline thickness in pixels
"shadow": 1.0, // Shadow depth in pixels
"alignment": 2, // Position (2=bottom center)
"margin_left": 30, // Left margin in pixels
"margin_right": 30, // Right margin in pixels
"margin_vertical": 30 // Bottom margin in pixels
}
}Colors use ASS format: &HAABBGGRR
- AA: Alpha (transparency) - 00=opaque, FF=transparent
- BB: Blue component (00-FF)
- GG: Green component (00-FF)
- RR: Red component (00-FF)
Common Colors:
- White:
&H00FFFFFF - Black:
&H00000000 - Red:
&H000000FF - Blue:
&H00FF0000 - Semi-transparent black:
&H80000000
1 = Bottom Left 2 = Bottom Center 3 = Bottom Right
4 = Middle Left 5 = Middle Center 6 = Middle Right
7 = Top Left 8 = Top Center 9 = Top Right
Copy and modify subtitle_config.json for different styles:
# Create multiple style configs
cp subtitle_config.json movie_style.json
cp subtitle_config.json anime_style.json
cp subtitle_config.json presentation_style.jsonThen edit each for different use cases.
Problem: MKVToolNix or FFmpeg not found Solution:
- Install the missing tools
- Ensure they're added to your system PATH
- Restart your terminal/command prompt
- Test with version commands shown above
Problem: GUI dependencies missing
Solution: pip install tkinterdnd2
Problem: Video file doesn't contain subtitle tracks Solution:
- Verify subtitles exist using MKVToolNix GUI
- Try a different video file
- Check if subtitles are in a separate file
Problem: Python or dependency issues Solution:
- Run
python main.pyfrom command line to see error messages - Check Python version:
python --version(needs 3.7+) - Reinstall dependencies:
pip install --force-reinstall tkinterdnd2
Problem: File access or tool permissions Solution:
- Check file permissions (read/write access)
- Run as administrator (Windows) or with sudo (Linux/macOS) if needed
- Ensure output directory is writable
Problem: Aegisub not found or not launching Solution:
- Install Aegisub from official website
- Ensure it's in your system PATH
- Try launching Aegisub manually first
- Check logs for specific error messages
- Check the logs: The system provides detailed logging information
- Test components individually: Use command-line tools directly
- Verify file formats: Ensure your video files are supported
- Check configurations: Validate your JSON syntax
Understanding how the system works helps with troubleshooting and customization:
User Input (GUI/CLI)
โ
main.py (Universal Launcher)
โ
UniversalSubtitleProcessor (Orchestrator)
โ
UniversalVideoProcessor (Format Abstraction)
โ
VideoProcessorFactory (Format Selection)
โ
MKVProcessor (Format Implementation)
โ
External Tools (MKVToolNix, FFmpeg)
- main.py: Entry point, CLI/GUI detection
- gui.py: Drag-and-drop interface, user interaction
- UniversalSubtitleProcessor: Workflow orchestration
- UniversalVideoProcessor: Format-agnostic interface
- VideoProcessorFactory: Processor selection and management
- MKVProcessor: MKV-specific operations
- SubtitleProcessor: Styling and format conversion
- AegisubProcessor: Manual editing integration
- FileManager: File operations and cleanup
- Use SSDs: Faster disk I/O improves processing speed
- Close other applications: Free up system resources
- Process smaller batches: Handle files in groups rather than all at once
- Use automatic styling: Skip manual editing for bulk processing
- Fastest: Automatic styling only (
--no-manual) - Balanced: Automatic styling with spot-checking
- Highest Quality: Manual editing for every file
- Temporary files: Automatically cleaned up after processing
- Output files: Generated with
_styledsuffix by default - Backup strategy: Keep originals until you're satisfied with results
The system is designed to be easily extensible. Here are some planned improvements:
- MP4 Processor: Coming soon for MP4/M4V files
- AVI Processor: Legacy format support
- Universal Format: Streaming and web video support
- Batch Configuration: Different styles for different file types
- Template System: Reusable styling templates
- Preview Mode: See styling before processing
- Cloud Integration: Process files in the cloud
- Watch Folders: Automatically process new files
- Scheduling: Process files at specific times
- Integration APIs: Connect with other tools
- Streaming Support: Real-time subtitle processing
The system is designed to make adding new formats trivial:
- Create processor class inheriting from
VideoProcessorBase - Implement all abstract methods for your format
- Register in factory by adding one line to
_register_default_processors() - Test and deploy - the entire system automatically supports your format!
- Modify configurations: Create new JSON configs for different styles
- Extend styling logic: Add new parameters to the styling engine
- Custom effects: Integrate with Aegisub automation scripts
- Media players: Direct integration with video playback software
- Content management: Batch processing for media libraries
- Streaming platforms: Automated subtitle preparation
- Accessibility tools: Enhanced subtitle processing for accessibility
The system's modular architecture makes it easy to extend and customize for specific needs while maintaining the core functionality and ease of use.