![]() - Complete removal of polling loops for better performance - Event-driven file processing with stability tracking - Proper structured logging with tracing - Graceful shutdown handling (SIGTERM/SIGINT) - Disk space monitoring (5GB minimum threshold) - Shared video_processing crate integration - Filename compatibility improvements (| → () separator) - Environment-based configuration - Comprehensive error handling and logging Features: - Intelligent sermon filename parsing (Title - Speaker (Date).mp4) - Date extraction with full month name support - Title and speaker metadata extraction - Environment variable configuration (SERMON_WATCH_PATH, SERMON_OUTPUT_PATH) - Hardware-accelerated video conversion (Intel QSV) - NFO file generation for Jellyfin compatibility - Syncthing temporary file filtering - AV1 video encoding with configurable settings Performance improvements: - No more wasteful 1-2 second polling - Only processes files when filesystem events occur - Proper resource management and cleanup |
||
---|---|---|
src | ||
tests | ||
.gitignore | ||
Cargo.lock | ||
Cargo.toml | ||
LICENSE | ||
README.md |
Sermon Converter
A Rust-based service that automatically monitors a directory for new sermon video files and converts them to an optimized format for streaming.
Features
- Automatic detection of new MP4 files in the watch directory
- Efficient video conversion using FFmpeg
- Preserves audio quality while optimizing video for streaming
- Automatic file organization with date-based naming
- Syncthing-aware (ignores temporary sync files)
Prerequisites
- Rust (latest stable version)
- FFmpeg installed and available in PATH
- Sufficient disk space for video processing
Installation
- Clone the repository:
git clone <your-repository-url>
cd sermon-converter
- Build the project:
cargo build --release
Configuration
The service uses environment variables for configuration:
SERMON_WATCH_PATH
: Directory to monitor for new sermon videosSERMON_OUTPUT_PATH
: Directory where converted videos will be saved
Example:
export SERMON_WATCH_PATH="/path/to/watch/directory"
export SERMON_OUTPUT_PATH="/path/to/output/directory"
Usage
Run the service:
cargo run --release
Or run the built binary:
./target/release/sermon_converter
The service will:
- Process any existing MP4 files in the watch directory
- Continue monitoring for new files
- Automatically convert new MP4 files as they appear
Running as a System Service
To run as a systemd service, create a service file at /etc/systemd/system/sermon-converter.service
:
[Unit]
Description=Sermon Video Converter Service
After=network.target
[Service]
Type=simple
User=<your-username>
Environment="SERMON_WATCH_PATH=/path/to/watch/directory"
Environment="SERMON_OUTPUT_PATH=/path/to/output/directory"
ExecStart=/path/to/sermon_converter
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
Enable and start the service:
sudo systemctl enable sermon-converter
sudo systemctl start sermon-converter
Video Conversion Details
The service converts videos using the following FFmpeg settings:
- Video codec: H.264 (libx264)
- Audio codec: AAC
- Video preset: medium
- Constant Rate Factor (CRF): 23
- Pixel format: yuv420p
- Audio bitrate: 128k
- Audio sample rate: 44100 Hz
File Naming Convention
Converted files are named based on the original filename's date pattern:
- Input:
YYYY-MM-DD_sermon.mp4
- Output:
YYYY-MM-DD_sermon_converted.mp4
Troubleshooting
- FFmpeg not found: Ensure FFmpeg is installed and in your system PATH
- Permission denied: Check that the service has read/write permissions for both watch and output directories
- Files not detected: Verify the watch directory path and that files are complete before processing
License
See LICENSE file for details.
Contributing
Contributions are welcome! Please submit pull requests or issues through the repository.