βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β ββββ βββββββββββββββββββ βββ ββββββ ββββββββββββ βββββββββββββββββββ βββ β β βββββ βββββββββββββββββββββββββββββββββββββββββββββ ββββββββββββββββββββ βββ β β βββββββββββββββββ βββ ββββββββββββββββββββββββββββββββββββ βββ ββββββββ β β βββββββββββββββββ βββ ββββββββββββββββββββββββββββββββββββ βββ ββββββββ β β βββ βββ βββββββββββββββββββββββββ ββββββββββββββ βββ ββββββ βββ βββ βββ β β βββ ββββββββββββββββββ ββββββ ββββββββββββββ ββββββ βββ βββ βββ β β β β MediaSmith v2.2 β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β― Advanced multimedia processing with multi-mode execution and real-time monitoring
- π Overview
- π Getting Started
- π€ Usage
- β‘ Real-time Monitoring
- π§ Execution Modes
- π Remote Backup System
- βοΈ Configuration Management
- π§ Administrative Commands
- π Testing
- π Troubleshooting
- π Project Structure
- π° Contributing
- π License
MediaSmith is a powerful multimedia processing script that handles video, audio, and image conversions with support for multiple execution modes, real-time monitoring, and automated processing workflows.
- Cross-Platform: Works on Linux and macOS with optimized monitoring for each platform
- Multiple Execution Modes: Choose the right mode for your performance needs
- Real-time Processing: Automatic file detection and processing with
inotifywait(Linux) orfswatch(macOS) - Simple Configuration: Easy setup with sensible defaults
# 1. Install all dependencies automatically
make all
# 2. Generate test files for development
make test
# 3. Run first conversion
./mediasmith.sh sample_file.jpg# 1. Make executable
chmod +x mediasmith.sh
# 2. Install dependencies manually
./scripts/deps_check.sh
# 3. Run first conversion
./mediasmith.sh sample_file.jpg- Required:
ffmpeg,imagemagick,bash(4.0+) - Linux:
inotify-toolsfor real-time monitoring - macOS:
fswatchfor real-time monitoring (install via Homebrew)
| Command | Description |
|---|---|
make all |
Install dependencies and build binaries |
make build |
Compile the C thread helper only |
make scripts-perm |
Make all scripts executable |
make deps |
Install system dependencies |
make test |
Generate test files |
make clean |
Clean build artifacts |
# Convert a single file
./mediasmith.sh image.jpg
# Convert a directory recursively
./mediasmith.sh -R /path/to/media/
# Custom output directory and format
./mediasmith.sh -o converted/ -v webm video.mp4| Option | Description |
|---|---|
-h |
Show help |
-R |
Process recursively |
-o <dir> |
Output directory |
-v <ext> |
Video format (mp4, webm, avi) |
-a <ext> |
Audio format (mp3, flac, wav) |
-i <ext> |
Image format (jpg, png, webp) |
MediaSmith supports real-time file monitoring on both Linux and macOS platforms.
# Install inotify-tools
sudo apt-get install inotify-tools # Ubuntu/Debian
sudo yum install inotify-tools # CentOS/RHEL
# Start monitoring
./mediasmith.sh --watch# Install fswatch via Homebrew
brew install fswatch
# Start monitoring
./mediasmith.sh --watch
# Run the script in background as Daemon
./mediasmith.sh --watch --daemon- Automatic Detection: MediaSmith detects available monitoring tools
- Fallback Mode: If no monitoring tools are available, uses polling
- Instant Processing: New files are processed immediately when detected
- Background Operation: Monitoring runs in the background
# Configure monitoring settings
./mediasmith.sh -c
# Key settings:
# - WATCH_DIR: Directory to monitor (default: ./files/)
# - WATCH_INTERVAL: Polling interval for fallback mode
# - AUTO_PROCESS: Enable/disable automatic processing# Start monitoring in background
./mediasmith.sh --watch &
# Copy files to watch directory
cp *.jpg files/
# Files are automatically converted!
# Check results
ls out/Choose the execution mode that fits your needs:
./mediasmith.sh file.jpg- Best for: Single files, interactive use
- Characteristics: Synchronous, full terminal output
./mediasmith.sh -f directory/ -r- Best for: Background batch processing
- Characteristics: Non-blocking, runs in background
./mediasmith.sh -s file.mp4- Best for: Isolated processing, testing
- Characteristics: Process isolation, protected environment
./mediasmith.sh -t directory/- Best for: High-performance batch operations
- Characteristics: Multi-threaded C helper, parallel processing
- Multi-core utilization: Automatically detects CPU cores
- Parallel processing: Up to 16 concurrent conversions
- Progress monitoring: Real-time conversion statistics
- Optimal for: Large batch operations (100+ files)
# High-performance batch processing
./mediasmith.sh -t /large/media/directory/MediaSmith includes automated backup functionality with cloud storage support.
# Interactive setup for cloud backup
./scripts/setup_remote_backup.sh
# Test backup configuration
./scripts/test_remote_backup.sh
# Manual backup trigger
./mediasmith.sh --backup- rclone integration for different cloud providers
- Automatic file synchronization after conversion
- Backup status tracking and logging
- Date-based backup organization
The backup system uses the following structure:
backup/- Local backup storagelogs/backed_up.log- Backup historylogs/to_backup.log- Files queued for backup
# Setup remote backup destination
./scripts/setup_remote_backup.sh
# Convert files (automatically queued for backup)
./mediasmith.sh video.mp4
# Check backup status
cat logs/backed_up.logMediaSmith provides comprehensive configuration management through interactive and file-based settings.
# Launch configuration editor
./mediasmith.sh -c
# Available configuration options:
LOG_LEVEL="INFO" # Logging verbosity (DEBUG, INFO, WARN, ERROR)
DEFAULT_OUT_DIR="out" # Default output directory
WATCH_INTERVAL="2" # Polling interval for file monitoring
default_video_ext="mp4" # Default video output format
default_audio_ext="mp3" # Default audio output format
default_image_ext="jpg" # Default image output format
REMOTE_DIR="backup_remote" # Remote backup directory pathconfig/config.cfg- Main configuration fileconfig/config.example.cfg- Template with all available options
# Custom configuration file
./mediasmith.sh --config /path/to/custom.cfg
# Override specific settings
LOG_LEVEL=DEBUG ./mediasmith.sh file.jpg
# Reset to defaults
./mediasmith.sh --restore-defaultsMediaSmith provides several administrative commands for system management.
# Restore default configuration (requires sudo)
sudo ./mediasmith.sh --restore
# Custom log directory
sudo ./mediasmith.sh -l /custom/log/path
# Check dependencies
./scripts/deps_check.sh# View conversion history
cat logs/converted_files.log
# View backup history
cat logs/backed_up.log
# View general system history
cat logs/history.log
# Generate test files for development
make testThe make test command executes populate_test_files.sh which creates a directory containing:
- Sample images (JPG, PNG, WebP)
- Sample videos (MP4, AVI)
- Sample audio files (MP3, WAV)
- Thread helper not found: Run
make buildto compile the C helper - Permission denied: Use
sudo ./mediasmith.sh --restoreto fix permissions - Monitoring not working: Install
inotify-tools(Linux) orfswatch(macOS) - Remote backup failing: Run
./scripts/test_remote_backup.shto diagnose
# Enable debug logging
LOG_LEVEL=DEBUG ./mediasmith.sh file.jpg
# View detailed logs
tail -f logs/history.log# Use thread mode for large batches
./mediasmith.sh -t /large/directory/
# Monitor conversion progress
watch -n 1 'ls -la out/'# Reset to default configuration
./mediasmith.sh --restore-defaults
# Verify configuration
./mediasmith.sh -cmediasmith/
βββ mediasmith.sh # Main script
βββ makefile # Build and setup automation
βββ README.md # Project documentation
βββ .gitignore # Git ignore rules
βββ backup/ # Backup storage
β βββ 2025-06-04/ # Date-based backups
βββ bin/ # Compiled binaries
β βββ thread_converter # Multi-threaded converter binary
βββ config/ # Configuration files
β βββ config.cfg # Main configuration
β βββ config.example.cfg # Configuration template
βββ files/ # Input directory (watched)
β βββ sample1.mp4 # Test video file
β βββ sample2.mkv # Test video file
β βββ sample3.wav # Test audio file
β βββ sample4.flac # Test audio file
β βββ sample5.png # Test image file
β βββ sample6.jpg # Test image file
βββ lib/ # Core modules
β βββ backup.sh # Backup functionality
β βββ conversion.sh # Conversion logic
β βββ logging.sh # Logging system
β βββ utils.sh # Utilities
β βββ watcher.sh # File monitoring
βββ logs/ # Log files
β βββ backed_up.log # Backup history
β βββ converted_files.log # Conversion history
β βββ history.log # General history
β βββ to_backup.log # Files to backup
βββ out/ # Output directory
β βββ audios/ # Converted audio files
β βββ images/ # Converted image files
β βββ videos/ # Converted video files
βββ scripts/ # Utility scripts
β βββ deps_check.sh # Dependency checker
β βββ populate_test_files.sh # Test file generator
β βββ setup_remote_backup.sh # Remote backup setup
β βββ test_remote_backup.sh # Backup testing
βββ src/ # Source code
βββ thread_converter.c # C source for multi-threaded converter
- Fork the repo
- Clone your fork
- Create a feature branch:
git checkout -b featureβxyz - Commit your changes with clear messages
- Push and open a PR against
main - Discuss & review until merged
Made with contrib.rocks.
MIT License - see LICENSE file for details.
MediaSmith v2.2 - Simple, powerful, cross-platform multimedia processing.