|
| 1 | +--- |
| 2 | +sidebar_position: 4 |
| 3 | +description: Create pseudo-TV networks from integrated media server content |
| 4 | +title: Media Networks Integration |
| 5 | +hide_title: true |
| 6 | +tags: |
| 7 | + - Integrations |
| 8 | + - Networks |
| 9 | + - Media Servers |
| 10 | + - Emby |
| 11 | + - Jellyfin |
| 12 | + - Plex |
| 13 | + - Broadcasting |
| 14 | +--- |
| 15 | + |
| 16 | +# Media Networks Integration |
| 17 | + |
| 18 | +:::info Experimental Feature |
| 19 | +Available in the **experimental** branch (`sparkison/m3u-editor:experimental`). |
| 20 | +Create pseudo-TV networks that broadcast content from your media server in a continuous loop. |
| 21 | +::: |
| 22 | + |
| 23 | +## Overview |
| 24 | + |
| 25 | +Transform VOD content and Series into 24/7 live TV channels with automatic EPG generation and HLS streaming. |
| 26 | + |
| 27 | +**Key Features:** |
| 28 | +- Continuous broadcasting with loop support |
| 29 | +- Automatic EPG generation |
| 30 | +- HLS streaming for broad compatibility |
| 31 | +- Mix movies and series episodes |
| 32 | +- Optional transcoding support |
| 33 | + |
| 34 | +## Prerequisites |
| 35 | + |
| 36 | +- M3U Editor experimental branch |
| 37 | +- Media server integration configured (Emby/Jellyfin/Plex) |
| 38 | +- M3U Proxy enabled for streaming |
| 39 | +- Media content synced into M3U Editor |
| 40 | + |
| 41 | +**Recommended:** Redis, PostgreSQL, hardware acceleration, adequate storage |
| 42 | + |
| 43 | +## Configuration |
| 44 | + |
| 45 | +Add to your `.env` file: |
| 46 | + |
| 47 | +```env |
| 48 | +# Enable broadcasting |
| 49 | +NETWORK_BROADCAST_ENABLED=true |
| 50 | +
|
| 51 | +# HLS storage |
| 52 | +HLS_TEMP_DIR=/var/www/html/storage/app/hls-segments |
| 53 | +HLS_GC_ENABLED=true |
| 54 | +HLS_GC_INTERVAL=600 # Cleanup every 10 minutes |
| 55 | +HLS_GC_AGE_THRESHOLD=7200 # Delete segments older than 2 hours |
| 56 | +``` |
| 57 | + |
| 58 | +**Optional but recommended:** |
| 59 | +```env |
| 60 | +REDIS_ENABLED=true |
| 61 | +ENABLE_POSTGRES=true |
| 62 | +M3U_PROXY_ENABLED=false # Use external proxy |
| 63 | +``` |
| 64 | + |
| 65 | +### Performance: HLS Segments on RAM Disk |
| 66 | + |
| 67 | +:::tip Better Performance |
| 68 | +For optimal performance and reduced disk wear, store HLS segments in RAM using tmpfs. This provides faster I/O and eliminates disk writes for temporary segment files. |
| 69 | +::: |
| 70 | + |
| 71 | +For better performance and reduced disk wear, store HLS segments in RAM using tmpfs: |
| 72 | + |
| 73 | +**Docker Compose:** |
| 74 | +```yaml |
| 75 | +services: |
| 76 | + m3u-editor: |
| 77 | + # ... other config ... |
| 78 | + volumes: |
| 79 | + - ./data:/var/www/config |
| 80 | + - pgdata:/var/lib/postgresql/data |
| 81 | + - type: tmpfs |
| 82 | + target: /var/www/html/storage/app/hls-segments |
| 83 | + tmpfs: |
| 84 | + size: 512M # Adjust based on concurrent networks |
| 85 | +``` |
| 86 | +
|
| 87 | +**Benefits:** |
| 88 | +- Faster read/write for HLS segments |
| 89 | +- Reduced SSD/HDD wear |
| 90 | +- Automatic cleanup on restart |
| 91 | +
|
| 92 | +**Considerations:** |
| 93 | +- RAM usage increases (50-200MB per active network) |
| 94 | +- Segments lost on container restart (regenerated automatically) |
| 95 | +- Not suitable for systems with limited RAM |
| 96 | +
|
| 97 | +## Quick Setup |
| 98 | +
|
| 99 | +### 1. Sync Media Server |
| 100 | +1. Navigate to **Integrations** → **Media Servers** |
| 101 | +2. Add your media server if needed |
| 102 | +3. Click **Sync Now** |
| 103 | +
|
| 104 | +### 2. Create Network |
| 105 | +1. Go to **Networks** → **Create Network** |
| 106 | +2. Set **Name**, **Channel Number**, and **Media Server** |
| 107 | +3. Enable **Loop Content** and **Enabled** |
| 108 | +4. Save |
| 109 | +
|
| 110 | +### 3. Add Content |
| 111 | +1. Open the network |
| 112 | +2. Click **Add Content** |
| 113 | +3. Select series episodes or movies |
| 114 | +4. Set **Sort Order** for playback sequence |
| 115 | +5. Save |
| 116 | +
|
| 117 | +### 4. Generate Schedule |
| 118 | +1. Click **Generate Schedule** |
| 119 | +2. Review in **Programme Schedule** section |
| 120 | +3. Enable **Auto-regenerate** to keep schedule updated |
| 121 | +
|
| 122 | +### 5. Start Broadcasting |
| 123 | +1. Open **Broadcast Settings** |
| 124 | +2. Enable **Broadcast Enabled** |
| 125 | +3. Configure HLS and transcoding options (see below) |
| 126 | +4. Click **Start Broadcast** |
| 127 | +
|
| 128 | +#### HLS Settings |
| 129 | +- **Segment Duration**: Length of each HLS segment in seconds (default: 6) |
| 130 | + - Lower = less latency, more CPU usage |
| 131 | + - Higher = better buffering, less CPU usage |
| 132 | +- **HLS List Size**: Number of segments to keep in playlist (default: 5) |
| 133 | +
|
| 134 | +#### Transcoding Settings |
| 135 | +- **Transcode Mode**: Choose transcoding behavior |
| 136 | + - `copy`: No transcoding (fastest, least compatible) - direct stream |
| 137 | + - `h264`: Transcode to H.264 (best compatibility, recommended) |
| 138 | + - `hevc`: Transcode to H.265/HEVC (better compression, newer devices) |
| 139 | +- **Video Bitrate**: Target video bitrate in kbps |
| 140 | + - Standard: 2500-3500 kbps |
| 141 | + - Low bandwidth: 1500 kbps |
| 142 | + - High quality: 6000+ kbps |
| 143 | +- **Audio Bitrate**: Target audio bitrate in kbps (typically 96-192 kbps) |
| 144 | + |
| 145 | +:::warning Resource Usage |
| 146 | +Transcoding is CPU-intensive. Use hardware acceleration with external m3u-proxy container and GPU passthrough (`/dev/dri:/dev/dri`) for optimal performance. |
| 147 | +::: |
| 148 | + |
| 149 | +## Access Your Network |
| 150 | + |
| 151 | +**HLS Stream:** |
| 152 | +``` |
| 153 | +http://your-server:36400/network/{network-uuid}/hls/playlist.m3u8 |
| 154 | +``` |
| 155 | +
|
| 156 | +**EPG:** |
| 157 | +``` |
| 158 | +http://your-server:36400/network/{network-uuid}/epg |
| 159 | +``` |
| 160 | +
|
| 161 | +Add to media clients using the playlist M3U URL and EPG URL. |
| 162 | +
|
| 163 | +## Troubleshooting |
| 164 | +
|
| 165 | +### Network Not Broadcasting |
| 166 | +- Verify `NETWORK_BROADCAST_ENABLED=true` in `.env` |
| 167 | +- Ensure content added and schedule generated |
| 168 | +- Check M3U Proxy is running: `docker ps | grep m3u-proxy` |
| 169 | +- Review logs: `docker logs m3u-editor` |
| 170 | +
|
| 171 | +### Stream Not Playing |
| 172 | +- Verify broadcast is running |
| 173 | +- Check HLS directory exists and is writable |
| 174 | +- Verify disk space: `df -h` |
| 175 | +- Check proxy logs: `docker logs m3u-proxy` |
| 176 | +
|
| 177 | +### EPG Not Showing |
| 178 | +- Click **Generate Schedule** |
| 179 | +- Refresh client's EPG data |
| 180 | +- Verify EPG URL in client |
| 181 | +
|
| 182 | +### High CPU Usage |
| 183 | +- Enable hardware acceleration with m3u-proxy |
| 184 | +- Reduce bitrate or use `copy` mode |
| 185 | +- Limit concurrent broadcasts |
| 186 | +
|
| 187 | +### Disk Space Issues |
| 188 | +- Verify `HLS_GC_ENABLED=true` |
| 189 | +- Lower `HLS_GC_AGE_THRESHOLD` value |
| 190 | +- Increase cleanup frequency with `HLS_GC_INTERVAL` |
| 191 | +
|
| 192 | +## Transcoding Profiles |
| 193 | +
|
| 194 | +**Low Bandwidth:** |
| 195 | +``` |
| 196 | +Mode: h264 | Video: 1500 kbps | Audio: 96 kbps | Segment: 4s |
| 197 | +``` |
| 198 | +
|
| 199 | +**Standard Quality:** |
| 200 | +``` |
| 201 | +Mode: h264 | Video: 3500 kbps | Audio: 128 kbps | Segment: 6s |
| 202 | +``` |
| 203 | +
|
| 204 | +**High Quality:** |
| 205 | +``` |
| 206 | +Mode: hevc | Video: 6000 kbps | Audio: 192 kbps | Segment: 10s |
| 207 | +``` |
| 208 | +
|
| 209 | +**Direct Streaming:** |
| 210 | +``` |
| 211 | +Mode: copy | Segment: 6s (best performance, limited compatibility) |
| 212 | +``` |
| 213 | +
|
| 214 | +## Docker Compose Example |
| 215 | +
|
| 216 | +**With tmpfs (RAM disk) for HLS segments:** |
| 217 | +```yaml |
| 218 | +services: |
| 219 | + m3u-editor: |
| 220 | + image: sparkison/m3u-editor:experimental |
| 221 | + container_name: m3u-editor |
| 222 | + environment: |
| 223 | + - TZ=America/New_York |
| 224 | + - APP_URL=http://localhost |
| 225 | + - APP_PORT=36400 |
| 226 | + - NETWORK_BROADCAST_ENABLED=true |
| 227 | + - HLS_TEMP_DIR=/var/www/html/storage/app/hls-segments |
| 228 | + - HLS_GC_ENABLED=true |
| 229 | + - M3U_PROXY_ENABLED=false |
| 230 | + - M3U_PROXY_HOST=m3u-proxy |
| 231 | + - M3U_PROXY_TOKEN=${M3U_PROXY_TOKEN} |
| 232 | + - REDIS_ENABLED=false |
| 233 | + - REDIS_HOST=redis |
| 234 | + - ENABLE_POSTGRES=true |
| 235 | + volumes: |
| 236 | + - ./data:/var/www/config |
| 237 | + - pgdata:/var/lib/postgresql/data |
| 238 | + - type: tmpfs |
| 239 | + target: /var/www/html/storage/app/hls-segments |
| 240 | + tmpfs: |
| 241 | + size: 512M |
| 242 | + ports: |
| 243 | + - "36400:36400" |
| 244 | + networks: |
| 245 | + - m3u-network |
| 246 | + depends_on: |
| 247 | + - m3u-proxy |
| 248 | + - redis |
| 249 | +
|
| 250 | + m3u-proxy: |
| 251 | + image: sparkison/m3u-proxy:experimental |
| 252 | + container_name: m3u-proxy |
| 253 | + environment: |
| 254 | + - API_TOKEN=${M3U_PROXY_TOKEN} |
| 255 | + - REDIS_ENABLED=true |
| 256 | + - REDIS_HOST=redis |
| 257 | + devices: |
| 258 | + - /dev/dri:/dev/dri # Hardware acceleration |
| 259 | + networks: |
| 260 | + - m3u-network |
| 261 | +
|
| 262 | + redis: |
| 263 | + image: redis:alpine3.22 |
| 264 | + container_name: m3u-redis |
| 265 | + command: redis-server --requirepass ${REDIS_PASSWORD} |
| 266 | + networks: |
| 267 | + - m3u-network |
| 268 | +
|
| 269 | +networks: |
| 270 | + m3u-network: |
| 271 | +
|
| 272 | +volumes: |
| 273 | + pgdata: |
| 274 | + redis-data: |
| 275 | +``` |
| 276 | + |
| 277 | +## FAQ |
| 278 | + |
| 279 | +**Q: Can I use multiple media servers in one network?** |
| 280 | +A: No, each network uses one media server. Create multiple networks for different servers. |
| 281 | + |
| 282 | +**Q: How much disk space needed?** |
| 283 | +A: 50-200 MB per network for HLS segments. Varies by bitrate and duration. |
| 284 | + |
| 285 | +**Q: Can viewers seek/rewind?** |
| 286 | +A: Limited seeking within buffered segments. For full control, use VOD/series directly. |
| 287 | + |
| 288 | +**Q: Can I schedule specific content at specific times?** |
| 289 | +A: Not currently. Schedule is auto-generated based on content duration and order. |
| 290 | + |
| 291 | +**Q: Multiple networks simultaneously?** |
| 292 | +A: Yes, but monitor system resources (CPU, disk, bandwidth). |
| 293 | + |
| 294 | +## Related Documentation |
| 295 | + |
| 296 | +- [Emby Integration](./emby_integration.md) |
| 297 | +- [Plex Integration](./plex_integration.md) |
| 298 | +- [Docker Compose Deployments](../deployment/docker-compose.md) |
| 299 | +- [Environment Variables](../advanced/environment-variables.md) |
| 300 | + |
| 301 | +## Support |
| 302 | + |
| 303 | +- [GitHub Issues](https://github.com/sparkison/m3u-editor/issues) |
| 304 | +- [Discord Community](https://discord.gg/rS3abJ5dz7) |
0 commit comments