Go to file
Benjamin Slingo a5c9cc0cda Simplify sermon converter for backend metadata handling
- Remove NFO file creation (backend now handles metadata)
- Simplify filename handling to preserve original names
- Remove complex parsing logic (no longer needed)
- Clean up configuration and dependencies
- Backend parses "Title - Speaker Date.mp4" format directly
2025-09-08 12:11:41 -04:00
src Simplify sermon converter for backend metadata handling 2025-09-08 12:11:41 -04:00
tests Major refactoring: Event-driven sermon converter 2025-09-06 18:30:06 -04:00
.gitignore Add environment variable support, documentation, and security improvements 2025-08-16 19:17:45 -04:00
Cargo.lock Simplify sermon converter for backend metadata handling 2025-09-08 12:11:41 -04:00
Cargo.toml Major refactoring: Event-driven sermon converter 2025-09-06 18:30:06 -04:00
LICENSE Add environment variable support, documentation, and security improvements 2025-08-16 19:17:45 -04:00
README.md Add environment variable support, documentation, and security improvements 2025-08-16 19:17:45 -04:00

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

  1. Clone the repository:
git clone <your-repository-url>
cd sermon-converter
  1. Build the project:
cargo build --release

Configuration

The service uses environment variables for configuration:

  • SERMON_WATCH_PATH: Directory to monitor for new sermon videos
  • SERMON_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:

  1. Process any existing MP4 files in the watch directory
  2. Continue monitoring for new files
  3. 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.