Add support for streaming single local video files

This commit is contained in:
Mathieu Moran
2026-01-12 20:19:56 -05:00
parent 3f8eae12c9
commit 28f9defc9b
2 changed files with 79 additions and 12 deletions
+30 -1
View File
@@ -30,7 +30,11 @@ Python script to stream M3U playlist files to RTMP servers using ffmpeg without
### Basic Usage
```bash
# Stream M3U playlist
python stream_m3u_to_rtmp.py <m3u_file> <rtmp_url>
# Stream single video file
python stream_m3u_to_rtmp.py <video_file> <rtmp_url> --single-file
```
### Examples
@@ -41,6 +45,22 @@ python stream_m3u_to_rtmp.py \
"playlist.m3u" \
"rtmp://live.twitch.tv/app/your_stream_key"
# Stream single local video file
python stream_m3u_to_rtmp.py \
"video.mp4" \
"rtmp://server.com/live/stream_key" \
--single-file
# Stream single video file (auto-detected by extension)
python stream_m3u_to_rtmp.py \
"video.mp4" \
"rtmp://server.com/live/stream_key"
# Stream single video URL
python stream_m3u_to_rtmp.py \
"https://example.com/video.mp4" \
"rtmp://server.com/live/stream_key"
# Stream with absolute path
python stream_m3u_to_rtmp.py \
"C:/path/to/playlist.m3u" \
@@ -95,10 +115,19 @@ Examples:
## Options
- `--loop-playlist`: Loop through the entire playlist when finished
- `--loop-playlist`: Loop through the entire playlist when finished (M3U only)
- `--loop-video`: Loop each individual video file indefinitely
- `--single-file`: Treat input as a single video file instead of M3U playlist
- `--ffmpeg`: Specify custom path to ffmpeg executable
## Input Types
The script supports two input types:
1. **M3U Playlist Files**: Automatically detected by file extension (.m3u, .m3u8)
2. **Single Video Files**: Automatically detected by video extensions (.mp4, .mkv, .avi, etc.) or use `--single-file` flag
3. **Video URLs**: HTTP/HTTPS URLs are automatically treated as single video files
## How It Works
The script: