How mpromonet/v4l2rtspserver works
v4l2rtspserver captures video from Video4Linux devices and optionally audio from ALSA, then exposes streams through RTSP/RTP or, when enabled, HTTP-based HLS and MPEG-DASH. The main workflow parses options, creates capture replicators, and registers unicast, multicast, or transport-stream sessions. The graph also preserves codec-specific capture, RTP session handling, and buffering. Some subsystem paths and links are based on README or SOURCE INDEX references; unsampled implementation details are not inferred.
Main entry points: V4l2RTSPServer.cpp Server orchestration · DeviceSourceFactory.h Source factory · main.cpp Option parsing · TSServerMediaSubsession.cpp Transport stream session
Components 20
Application entry
- Option parsing
main.cpp
Capture and framing
- V4L2 capture
src/V4L2DeviceSource.cpp - Source factory
inc/DeviceSourceFactory.h - H.264/H.265 source
src/H26x_V4l2DeviceSource.cpp - H.264 source variant
src/H264_V4l2DeviceSource.cpp - H.265 source variant
src/H265_V4l2DeviceSource.cpp - MJPEG framing
src/MJPEGVideoSource.cpp - ALSA capture
src/ALSACapture.cpp
RTSP and RTP
- Server orchestration
src/V4l2RTSPServer.cpp - RTP format handling
src/ServerMediaSubsession.cpp - Unicast session
src/UnicastServerMediaSubsession.cpp - Multicast session
src/MulticastServerMediaSubsession.cpp - Transport stream session
src/TSServerMediaSubsession.cpp
HTTP streaming
- Segment buffer
src/MemoryBufferSink.cpp - HTTP playlists and segments
src/HTTPServer.cpp
Other components
- Operator
- Video device
- ALSA device
- RTSP clients
- HTTP playback clients
Connections 22
- Operator → Option parsing: sets options
README.md - Option parsing → Server orchestration: configures
main.cpp - Option parsing → Source factory: requests sources
main.cpp - Server orchestration → Source factory: creates video streams
src/V4l2RTSPServer.cpp - Source factory → V4L2 capture: creates source
inc/DeviceSourceFactory.h - Source factory → H.264 source variant: selects H.264
inc/DeviceSourceFactory.h - Source factory → H.265 source variant: selects H.265
inc/DeviceSourceFactory.h - H.264 source variant → H.264/H.265 source: uses framing
- H.265 source variant → H.264/H.265 source: uses framing
- Video device → V4L2 capture: provides frames
README.md - ALSA device → ALSA capture: provides audio
README.md - Server orchestration → ALSA capture: creates audio streams
src/V4l2RTSPServer.cpp - Server orchestration → Unicast session: registers sessions
- Server orchestration → Multicast session: registers sessions
- Server orchestration → Transport stream session: registers HLS sessions
- Unicast session → RTP format handling: uses format handling
- Multicast session → RTP format handling: uses format handling
- Transport stream session → Unicast session: extends session
- Transport stream session → Segment buffer: uses segment buffer
- Server orchestration → HTTP playlists and segments: configures server
- RTSP clients → Server orchestration: requests RTP streams
README.md - HTTP playback clients → HTTP playlists and segments: requests HLS/DASH
README.md