DVR¶
Mcaster DVR module writes video archives to disk and enables playback of recorded content. This functionality allows users to pause live broadcasts, rewind to earlier parts of programs, and access archived content from previous days.
Overview¶
The DVR module provides comprehensive video recording and archive management capabilities. It supports various playback scenarios including:
- Pausing live broadcasts to take breaks
- Watching current programs from the beginning
- Accessing yesterday's programs
- Bookmarking favorite programs for later viewing
Key Features¶
- Continuous Recording: Automatic archive creation with configurable retention periods
- Multiple Playback Methods: Support for different timeshift approaches
- Middleware Integration: Seamless integration with IPTV middleware systems
- Flexible Storage: Configurable storage locations and retention policies
- Timeshift Support: Both relative and absolute timeshift capabilities
Basic Configuration¶
Simple DVR Setup¶
stream example_channel {
input udp://239.0.0.1:1234;
dvr /storage 7d;
}
Where:
* /storage
- path to storage directory (stream name will be automatically added)
* 7d
- retention period (7 days)
Advanced DVR Configuration¶
stream premium_channel {
input udp://239.0.0.1:1234;
dvr /storage 30d;
}
Playback Methods¶
EPG-Based Archive Playback¶
For middleware systems with precise EPG schedules, use EPG-based archive URLs:
http://MCASTER-IP/STREAM_NAME/archive-START_TIME-DURATION.m3u8?event=true
Where:
* START_TIME
- program start time in UTC (Epoch time)
* DURATION
- program duration in seconds
Example:
http://192.168.1.100/news_channel/archive-1717677139-2116.m3u8?event=true
This method allows:
- Seeking within the program
- Pausing and resuming
- Fast forward playback
Event Playlists for Live Content¶
For current broadcasts, use event playlists that automatically switch from EVENT to VOD mode:
http://MCASTER-IP/STREAM_NAME/archive-START_TIME-DURATION.m3u8?event=true
Important Notes:
- Event playlists don't support rewinding in native Safari
- Requires custom JavaScript timeline implementation for TV applications
- Automatic switching between EVENT and VOD modes
Timeshift Capabilities¶
Relative Timeshift¶
Create delayed streams with fixed time offsets:
stream delayed_channel {
input timeshift://original_channel/3600;
}
This creates a stream with 1-hour delay (3600 seconds).
Absolute Timeshift¶
For personalized timeshift access, use absolute timeshift URLs:
HLS Playback:
http://MCASTER-IP/STREAM_NAME/timeshift_abs-TIMESTAMP.m3u8
HTTP MPEG-TS Playback:
http://MCASTER-IP/STREAM_NAME/timeshift_abs-TIMESTAMP.ts
Where TIMESTAMP
is the absolute time in UTC (Epoch time).
Handling Archive Gaps¶
When archive contains gaps (e.g., source downtime), use the ignore_gaps=true
parameter:
http://MCASTER-IP/STREAM_NAME/timeshift_abs-123123123.m3u8?ignore_gaps=true
This allows playback to continue by skipping gaps in the archive.
Middleware Integration¶
EPG-VOD Method¶
For playing archived content, use EPG-based URLs:
http://MCASTER-IP/STREAM_NAME/archive-START_TIME-DURATION.m3u8?event=true
Implementation Requirements:
- Precise EPG schedule maintenance
- UTC time handling (avoid local time)
- Viewing time storage in middleware database
- Automatic program switching at playback end
Event Playlist Method¶
For current broadcasts, use event playlists with automatic mode switching:
http://MCASTER-IP/STREAM_NAME/archive-START_TIME-DURATION.m3u8?event=true
Key Features:
- Automatic EVENT to VOD switching
- Pause and resume functionality
- Custom "live" button implementation required
- EPG-based program continuation
Scalability Considerations¶
Timeshift_abs Limitations¶
The timeshift_abs
method has significant scalability limitations:
- Session Management: Flussonic uses probabilistic session joining based on client IP, channel name, protocol, and token
- Consecutive Requests: Multiple timeshift_abs requests may be treated as the same session
- Viewing Distortion: Can cause playback issues with multiple simultaneous users
- Token Requirements: New tokens should be passed for each timeshift_abs request
Scaling Solutions¶
For high-user scenarios, consider these approaches:
Proportional DVR Servers:
- Deploy DVR servers proportionally to the number of viewers
- Each server handles a subset of users
- Reduces session conflicts
Alternative Methods:
- Use relative timeshift for popular content
- Implement middleware-based timeshift management
- Consider CDN integration for archive distribution
Storage Management¶
Retention Policies¶
Configure retention periods based on content type and storage capacity:
stream news_channel {
input udp://239.0.0.1:1234;
dvr /storage 7d; # 7 days retention
}
stream movies_channel {
input udp://239.0.0.1:1234;
dvr /storage 30d; # 30 days retention
}
Storage Optimization¶
- Segment Duration: Balance between seek granularity and storage efficiency
- Compression: Use appropriate video compression for archive storage
- Cleanup: Implement automatic cleanup of expired archives
- Monitoring: Track storage usage and archive health
Performance Monitoring¶
Key Metrics¶
- Recording Performance: Monitor archive creation speed and reliability
- Playback Performance: Track timeshift request success rates
- Storage Utilization: Monitor disk usage and cleanup efficiency
- Session Management: Track timeshift_abs session conflicts
Health Checks¶
- Archive Integrity: Verify recorded content quality
- Storage Availability: Monitor disk space and I/O performance
- Network Performance: Track archive delivery metrics
- Error Rates: Monitor recording and playback failures
Troubleshooting¶
Common Issues¶
- Archive Gaps: Use
ignore_gaps=true
parameter or investigate source issues - Session Conflicts: Implement proper token management for timeshift_abs
- Storage Full: Monitor retention policies and cleanup processes
- Playback Errors: Check archive integrity and network connectivity
Debug Tools¶
- Archive Inspection: Verify recorded content and timestamps
- Session Logs: Monitor timeshift session management
- Storage Analysis: Check disk usage and I/O patterns
- Network Diagnostics: Verify archive delivery performance