A powerful PowerShell-based solution for converting RTSP camera streams to web-compatible HLS (HTTP Live Streaming) format. This tool enables you to view multiple IP camera feeds directly in web browsers with automatic monitoring, recovery, email alerts, and a user-friendly management interface.
- Multi-Camera Support: Manage and stream multiple IP cameras simultaneously
- RTSP to HLS Conversion: Converts RTSP streams to web-compatible HLS format using FFmpeg
- Web-Based Viewing: Stream cameras directly in any modern web browser
- SSL/HTTPS Support: Secure streaming with Apache SSL configuration
- Automatic Health Monitoring: Continuously monitors stream health and performance
- Auto-Recovery: Automatically restarts failed streams without manual intervention
- Real-Time Statistics: Track frame rates, memory usage, and stream quality
- Comprehensive Logging: Detailed logs for troubleshooting and analysis
- SMTP Email Alerts: Receive email notifications when streams fail
- Configurable Thresholds: Set restart count thresholds for alerts
- Multi-Recipient Support: Send alerts to up to 5 email addresses
- Smart Alert Logic: First alert on failure, final alert after 15 minutes without recovery
- Recovery Notifications: Automatic alerts when streams recover
- Per-Camera Alert Control: Enable/disable alerts for individual cameras
- Password Encryption: RTSP and SMTP passwords are automatically encrypted
- Secure Storage: Encrypted passwords stored in config.json
- User-Specific Encryption: Passwords encrypted per Windows user account
- Automatic Migration: Plain-text passwords automatically encrypted on first run
- Automatic Config Creation: config.json created automatically on first run
- Configuration Validation: Comprehensive validation of all settings
- Backward Compatibility: Automatic migration of older config formats
- Default Values: Sensible defaults for all new configuration options
- Interactive Menu System: Easy-to-use PowerShell interface for managing streams
- Live Log Viewer: View logs from all cameras and services in real-time
- Process Control: Start, stop, and restart individual cameras or all streams
- Status Dashboard: Monitor all cameras and services at a glance
- Hardware Acceleration: NVIDIA GPU encoding support (h264_nvenc)
- Scheduled Restarts: Automatic 24-hour restart cycle for stability
- Log Compression: NTFS compression for efficient log storage
- Configurable Timing: Fine-tune all delays and intervals for optimal performance
- Windows Server 2016+ or Windows 10/11
- PowerShell 5.1 or higher
- Administrator privileges for service management
- NVIDIA GPU (optional, for hardware acceleration)
- FFmpeg: Download from https://www.ffmpeg.org/
- Install to:
C:\ffmpeg
- Install to:
- Apache HTTP Server 2.4: Download from https://httpd.apache.org/
- Install to:
C:\Apache24
- Install to:
- Access to IP cameras via RTSP protocol
- Open ports: 80 (HTTP) and 443 (HTTPS)
- Static IP or DNS name for the server
- SMTP server access (optional, for email alerts)
# Extract all files to a directory, e.g., C:\RTSPConverter- Install FFmpeg to
C:\ffmpeg - Install Apache24 to
C:\Apache24 - See INSTALLATION.md for detailed instructions
NEW in v4.0.0: The script automatically creates config.json on first run!
# Run as Administrator
.\RTSPStreamConverter.ps1The script will:
- Create a default config.json file with all cameras disabled
- Set up all required directories
- Enable NTFS compression on log directories
- Display the interactive menu
Edit config.json to add your camera details:
{
"Cameras": {
"Camera1": {
"Name": "Front Door Camera",
"Enabled": true,
"RTSP": {
"Username": "admin",
"Password": "password",
"IPAddress": "192.168.1.100",
"Port": 554,
"Suffix": "Streaming/Channels/101"
}
}
}
}Note: Passwords will be automatically encrypted on next run!
{
"EmailAlerts": {
"Enabled": true,
"SMTPServer": "smtp.gmail.com",
"Port": 587,
"UseSTARTTLS": true,
"Username": "your-email@gmail.com",
"Password": "your-app-password",
"FromAddress": "your-email@gmail.com",
"ToAddresses": ["admin@example.com", "alerts@example.com"],
"RestartThreshold": 3
}
}Open your browser and navigate to:
https://your-domain.com/streaming.m3u8(main camera)https://your-domain.com/camera2/streaming.m3u8(camera 2)- Or use the provided HTML viewer pages
RTSPConverter/
├── RTSPStreamConverter.ps1 # Main PowerShell script
├── config.json # Configuration file (auto-created)
├── httpd.conf # Apache main configuration
├── httpd-ssl.conf # Apache SSL configuration
├── .htaccess # Access control file
├── stream.html # Basic stream viewer
├── streamiframe.html # Iframe-embedded viewer
├── streammobile.html # Mobile-optimized viewer
├── streamfull.html # Full-page viewer with title
├── README.md # This file
├── INSTALLATION.md # Detailed installation guide
├── CONFIGURATION.md # Configuration reference
├── TROUBLESHOOTING.md # Common issues and solutions
└── RTSP-CAMERAS.md # Camera-specific RTSP URLs
- Monitor multiple security cameras from any device
- Receive email alerts when cameras go offline
- Access cameras remotely via web browser
- No need for proprietary software or apps
- Centralized camera management for offices or retail
- Email notifications for critical camera failures
- Share camera feeds with authorized personnel
- Integration with existing web infrastructure
- Stream events or locations to the web
- Embed camera feeds in websites
- Low-latency streaming with HLS
- Monitor remote locations or equipment
- Email alerts for connection issues
- Access cameras from anywhere with internet
- Automatic recovery from network interruptions
Each camera requires the following settings in config.json:
- Name: Friendly name for the camera
- Enabled: Set to
trueto activate the camera - RTSP Settings: Username, password, IP address, port, and URL suffix
- HLS Settings: Bitrate, buffer size, and segment settings
- Paths: Output directories and log file locations
- AlertEnabled: Enable/disable email alerts for this camera (NEW)
Configure SMTP settings for email notifications:
- Enabled: Enable/disable email alerts
- SMTPServer: SMTP server address
- Port: SMTP port (typically 587 for TLS, 465 for SSL)
- UseSTARTTLS: Enable STARTTLS encryption
- Username: SMTP authentication username
- Password: SMTP authentication password (auto-encrypted)
- FromAddress: Sender email address
- ToAddresses: Array of up to 5 recipient addresses
- RestartThreshold: Number of restarts before sending alert
- EmailTimeoutSeconds: Timeout for email sending (default: 30)
- RestartWindowMinutes: Time window for counting restarts (default: 5)
- FinalAlertDelayMinutes: Delay before final alert (default: 15)
- RecoveryStableMinutes: Stability period before recovery alert (default: 1)
Fine-tune all timing parameters:
"Timing": {
"ProcessStartDelaySeconds": 2,
"ProcessStopDelaySeconds": 2,
"RestartDelaySeconds": 3,
"WindowOpenDelayMilliseconds": 500,
"ShortDelayMilliseconds": 100,
"MonitoringLoopDelaySeconds": 1
}Global FFmpeg settings:
"FFmpeg": {
"RTSPTransport": "tcp",
"RTSPFlags": "prefer_tcp",
"RTSPTimeoutMicroseconds": 5000000,
"VideoCodec": "h264",
"HLSSegmentTimeSeconds": 2,
"HLSAllowCache": 0,
"HLSFlags": "delete_segments"
}Two configuration files need to be edited:
httpd.conf (C:\Apache24\conf\httpd.conf):
ServerAdmin: Your email addressServerName: Your domain name
httpd-ssl.conf (C:\Apache24\conf\extras\httpd-ssl.conf):
ServerName: Your domain name with portServerAdmin: Your email addressSSLCertificateFile: Path to SSL certificateSSLCertificateKeyFile: Path to SSL private keySSLCertificateChainFile: Path to SSL chain file
Edit the HTML viewer files to point to your camera streams:
<source type="application/x-mpegURL" src="https://your-domain.com/streaming.m3u8">Replace domain.ca with your actual domain or IP address.
The script provides an interactive menu with the following options:
- Start All Streams: Start Apache and all enabled cameras
- Stop All Streams: Stop all processes gracefully
- Restart All Streams: Restart everything
- View Status: Display current status of all services
- Open Log Viewer: View logs in real-time
- Configure Settings: Configure most settings for the script
Logs are stored in C:\ffmpeg\logs\ and include:
- Main script log:
rtsp_converter_YYYYMMDD.log - Camera FFmpeg logs:
ffmpeg_camera1_error.txt - Apache access log:
C:\Apache24\logs\ssl\access.log
The script monitors:
- Frame rate for each camera
- Memory usage per process
- Stream health status
- Uptime and restart counts
- Email alert status
- All passwords are automatically encrypted on first run
- Encryption is user-specific (tied to Windows user account)
- Encrypted passwords stored in config.json
- Plain-text passwords automatically migrated to encrypted format
- Always use HTTPS for production deployments
- Obtain valid SSL certificates (Let's Encrypt, commercial CA)
- Configure firewall rules to restrict access
- Use strong passwords for camera RTSP authentication
- Implement Apache authentication for web access
- Use
.htaccessfiles to control access to streams - Secure SMTP credentials with encryption
- Place cameras on isolated VLAN
- Use VPN for remote access
- Regularly update Apache and FFmpeg
- Monitor email alerts for security issues
Stream not loading in browser:
- Check if Apache is running
- Verify FFmpeg process is active
- Check firewall settings
- Review FFmpeg error logs
FFmpeg keeps restarting:
- Verify RTSP URL is correct
- Check camera credentials
- Ensure camera is accessible on network
- Review camera-specific RTSP suffix
- Check email alerts for detailed error information
Email alerts not working:
- Verify SMTP server settings
- Check SMTP credentials
- Ensure port 587/465 is not blocked
- Review email timeout settings
- Check ToAddresses are valid
High CPU/Memory usage:
- Reduce bitrate in camera configuration
- Disable hardware acceleration if causing issues
- Limit number of concurrent streams
- Adjust monitoring intervals
For detailed troubleshooting, see TROUBLESHOOTING.md
- INSTALLATION.md: Step-by-step installation guide
- CONFIGURATION.md: Detailed configuration reference
- TROUBLESHOOTING.md: Common problems and solutions
- RTSP-CAMERAS.md: Camera-specific RTSP URL formats
- Email Alert System: Comprehensive SMTP-based alerting for stream failures
- Password Encryption: Automatic encryption of all sensitive credentials
- Configuration Validation: Validates all settings on startup
- Auto-Configuration: Creates default config.json automatically
- Enhanced Timing Control: Fine-tune all delays and intervals
- FFmpeg Global Settings: Centralized FFmpeg configuration
- Smarter alert logic with first and final notifications
- Recovery alerts when streams stabilize
- Per-camera alert enable/disable
- Backward compatibility with v3.x configurations
- Enhanced startup monitoring
- Better error handling and logging
- Automatic log archive cleanup (removed per user request)
- Christopher McGrath
- FFmpeg - Multimedia framework
- Apache HTTP Server - Web server
- Video.js - HTML5 video player
This software is provided "as is" without warranty of any kind. Use at your own risk. Always ensure you have permission to access and stream from IP cameras.
Version: 4.0.0
Last Updated: 2025-10-10
Minimum PowerShell Version: 5.1
Tested On: Windows Server 2019, Windows 10/11