
- Update main.rs to use environment variables for paths (required) - Add comprehensive README.md with setup and usage instructions - Add MIT LICENSE file - Enhance .gitignore to exclude sensitive files and common artifacts - Add .env.example template for configuration
119 lines
2.8 KiB
Markdown
119 lines
2.8 KiB
Markdown
# 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:
|
|
```bash
|
|
git clone <your-repository-url>
|
|
cd sermon-converter
|
|
```
|
|
|
|
2. Build the project:
|
|
```bash
|
|
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:
|
|
```bash
|
|
export SERMON_WATCH_PATH="/path/to/watch/directory"
|
|
export SERMON_OUTPUT_PATH="/path/to/output/directory"
|
|
```
|
|
|
|
## Usage
|
|
|
|
Run the service:
|
|
```bash
|
|
cargo run --release
|
|
```
|
|
|
|
Or run the built binary:
|
|
```bash
|
|
./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`:
|
|
|
|
```ini
|
|
[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:
|
|
```bash
|
|
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. |