VideoReader Plugin¶
Description¶
The VideoReader plugin provides generic video input capabilities for CVEDIA-RT, serving as a unified interface for various video sources and formats. It offers standardized video reading functionality with cross-platform support and flexible configuration options.
VideoReader acts as a versatile video input solution that can handle multiple video formats and sources. It provides a consistent interface for video reading operations while supporting various backends and optimization strategies based on the platform and available hardware.
Key capabilities include:
- Multi-format video file support
- Generic video stream handling
- Cross-platform compatibility
- Configurable playback options
- Integration with video processing pipelines
Configuration¶
Basic Configuration¶
{
"input": {
"handlers": {
"video-input": {
"uri": "file:///path/to/video.mp4",
"plugin": "VideoReader",
"enabled": true
}
}
}
}
Advanced Configuration¶
{
"input": {
"handlers": {
"video-input": {
"uri": "file:///path/to/video.mp4",
"plugin": "VideoReader",
"start_frame": 0,
"end_frame": 1000,
"real_time": true,
"sampling_rate": 1,
"enabled": true
}
}
}
}
Configuration Parameters¶
Parameter | Type | Default | Description |
---|---|---|---|
uri |
string | - | Video source URI (file path or stream URL) |
start_frame |
integer | 0 | Starting frame number for playback |
end_frame |
integer | 0 | Ending frame number (0 = end of video) |
real_time |
boolean | true | Enable real-time playback timing |
sampling_rate |
integer | 1 | Frame sampling rate (1 = every frame) |
Supported URIs¶
The VideoReader plugin supports various URI schemes:
- File URIs:
file:///path/to/video.mp4
- HTTP/HTTPS:
http://example.com/stream.mp4
- RTSP Streams:
rtsp://camera.example.com/stream
- Local Files: Direct file paths
API Reference¶
Core Functionality¶
The VideoReader plugin provides standard video input capabilities including:
- Video file opening and validation
- Frame-by-frame reading
- Seeking and positioning
- Format detection and handling
- Playback control and timing
Integration Points¶
- Input Pipeline: Integrates with CVEDIA-RT's input processing system
- Buffer Management: Utilizes efficient frame buffering
- Format Conversion: Automatic format conversion when needed
- Error Handling: Robust error detection and recovery
Examples¶
Basic Video File Input¶
-- Configure VideoReader for file input
local config = {
input = {
handlers = {
["video-file"] = {
uri = "file:///data/videos/sample.mp4",
plugin = "VideoReader",
enabled = true
}
}
}
}
Stream Input with Custom Settings¶
-- Configure VideoReader for streaming input
local config = {
input = {
handlers = {
["video-stream"] = {
uri = "rtsp://192.168.1.100/stream",
plugin = "VideoReader",
real_time = true,
sampling_rate = 2, -- Process every 2nd frame
enabled = true
}
}
}
}
Batch Processing Configuration¶
-- Configure VideoReader for batch video processing
local config = {
input = {
handlers = {
["batch-video"] = {
uri = "file:///data/batch/video.avi",
plugin = "VideoReader",
start_frame = 100,
end_frame = 500,
real_time = false,
enabled = true
}
}
}
}
Performance Considerations¶
Optimization Tips¶
- Use appropriate sampling rates to balance processing speed and accuracy
- Consider hardware acceleration when available
- Optimize buffer sizes for your specific use case
- Monitor memory usage with large video files
Platform-Specific Notes¶
- Windows: Leverages native video codecs and DirectShow
- Linux: Uses GStreamer and FFmpeg backends
- Cross-platform: Consistent API regardless of underlying implementation
Troubleshooting¶
Common Issues¶
Video format not supported - Ensure the video codec is supported on your platform - Check if additional codec packs are required - Verify file integrity and format
Performance issues - Adjust sampling rate to reduce processing load - Consider using hardware acceleration - Monitor system resources and optimize accordingly
Stream connection failures - Verify network connectivity and stream availability - Check firewall and security settings - Validate stream URLs and authentication
Error Messages¶
- "Failed to open video source": Check URI format and file accessibility
- "Unsupported video format": Install required codecs or use different format
- "Stream timeout": Verify network connection and stream availability
See Also¶
- Input Plugin Overview
- FFmpeg Reader Plugin - Specialized FFmpeg-based video input
- GStreamer Reader Plugin - GStreamer-based video input
- Plugin Overview