MediaX¶
Real-Time Protocol (RTP) Video Streaming Library for C++
Overview¶
MediaX is a high-performance C++ library implementing RFC 4421 RTP (Real Time Protocol) Payload Format for Uncompressed Video and RFC 3984 for H.264 video and RFC 7798 for H.265 video. It is compliant with DEF STAN 00-082 (VIVOE) for real-time video streaming in defence and industrial applications.
Key Features¶
- MISRA C++:2023 - Library code lint-clean against MISRA C++:2023 with every deviation justified in source (see MISRA Compliance)
- Uncompressed Video Streaming - RGB24, YUV422, Mono8, Mono16 (RFC 4421)
- H.264 - VAAPI, NVIDIA NVENC/NVDEC, Jetson Multimedia API, V4L2 M2M (Raspberry Pi), Android
AMediaCodecand OpenH264 (software) - H.265 - Intel/AMD VAAPI (RFC 7798)
- AV1 - Intel 12th gen+ / AMD RDNA2+ via native VAAPI, plus Jetson decode
- JPEG - RFC 2435 Motion JPEG through libjpeg, interoperable with ffmpeg and GStreamer, with Qt6 wrappers
- Android Support - Native H.264 hardware encode/decode via NDK
AMediaCodec, with Qt6 widget wrappers - GigE Vision (experimental) - AIA GigE Vision 2.x industrial camera streaming (GVCP/GVSP/GenICam)
- RTSP Receiver - Pull H.264 video from IP cameras and RTSP servers (RFC 2326) over UDP, multicast or TCP, with Basic/Digest authentication, auto-reconnect and a stream liveness probe
- HLS Receiver - Play HTTP Live Streaming (RFC 8216)
.m3u8playlists with MPEG-TS H.264 segments, AES-128 decryption, variant selection and live refresh. Audio is delivered to the application as PCM or encoded data, and thehls-playerexample plays the live ABC TV feed with sound - SRT Video (Drones) - Send and receive H.264, H.265 and AV1 over SRT with 100 to 500 ms latency, self-healing retransmission, optional AES encryption and caller, listener and rendezvous modes. Native implementation, no libsrt needed, H.264 and H.265 interoperable with ffmpeg, VLC and OBS
- Chromecast Casting - Detect Chromecasts on the network with multicast DNS and cast H.264 video, test cards or a SAP announced RTP stream to them as live HLS. Native implementation, no Cast SDK needed, OpenSSL only for the TLS control connection
- SAP/SDP Announcements - Automatic stream discovery (RFC 2974, RFC 4566)
- Cross-Platform - Linux x86_64, ARM64 (Jetson, Raspberry Pi), Android
- Multiple Language Bindings - C++, Python, Qt6
- Colourspace Conversion - CPU, AVX2 SIMD, CUDA GPU — including Bayer demosaicing
- Codec Query API - Runtime discovery of available encoders and decoders
Supported Standards¶
| Standard | Description |
|---|---|
| RFC 4421 | RTP Payload Format for Uncompressed Video |
| RFC 3984 | RTP Payload Format for H.264 Video |
| RFC 7798 | RTP Payload Format for H.265/HEVC Video |
| RFC 2435 | RTP Payload Format for JPEG-compressed Video |
| RFC 2326 | Real Time Streaming Protocol (RTSP) client |
| RFC 8216 | HTTP Live Streaming (HLS) client |
| draft-sharabayko-srt | Secure Reliable Transport (SRT), live streaming mode |
| Google Cast (CASTv2) | Chromecast discovery (mDNS) and casting of H.264 as live HLS |
| RFC 6184 / RFC 7798 | H.264 and H.265 carried in MPEG-TS and repacked for the decoders |
| AOM AV1 RTP / AV1 in MPEG-2 TS | AV1 carried in MPEG-TS over SRT and repacked into AV1 RTP for the decoder |
| RFC 3550 | RTP / RTCP (receiver reports, jitter and loss) |
| RFC 2974 | Session Announcement Protocol (SAP) |
| RFC 4566 | Session Description Protocol (SDP) |
| AIA GigE Vision 2.x | Industrial camera control (GVCP) and streaming (GVSP) (experimental) |
| EMVA GenICam 3.x | Camera XML device description (SFNC) |
| DEF STAN 00-082 | VIVOE — Video and Imagery over Ethernet for Defence |
Supported Platforms¶
| Platform | Architecture | Status |
|---|---|---|
| Ubuntu 24.04 LTS | amd64 | ✅ Supported |
| Ubuntu 26.04 LTS | amd64 | ✅ Supported |
| AlmaLinux 9 | amd64 | ✅ Supported |
| AlmaLinux 10 | amd64 | ✅ Supported |
| Ubuntu 24.04 LTS | arm64 | ✅ Supported |
| NVIDIA Jetson | arm64 | ✅ Supported |
| Android | arm64, arm | ✅ Supported (NDK AMediaCodec) |
Windows is not a supported platform. See Hardware Acceleration for the full codec, hardware offload engine and platform matrices.
Supported Codecs¶
| Codec | Standard | Backends | Encode | Decode |
|---|---|---|---|---|
| Uncompressed (RGB24, YUV 4:2:2, Mono8, Mono16) | RFC 4421 | CPU (AVX2 / CUDA colourspace) | ✅ | ✅ |
| H.264 | RFC 3984 / RFC 6184 | VAAPI, NVENC/NVDEC, Jetson, V4L2 M2M, Android AMediaCodec, OpenH264 | ✅ | ✅ |
| H.265 (HEVC) | RFC 7798 | VAAPI | ✅ | ✅ |
| AV1 | AV1 RTP payload format | VAAPI; Jetson (decode only) | ✅ | ✅ |
| JPEG | RFC 2435 | libjpeg (software) | ✅ | ✅ |
| GigE Vision | AIA GigE Vision 2.x | CPU | ✅ | ✅ |
Hardware Offload Engines¶
| Engine | Hardware | Codecs |
|---|---|---|
| VAAPI | Intel (6th gen+), AMD (GCN 3+) | H.264, H.265, AV1 |
| NVENC / NVDEC | NVIDIA GPUs (Kepler+) | H.264 |
| Jetson Multimedia API | NVIDIA Jetson | H.264, AV1 (decode) |
| V4L2 M2M | Raspberry Pi, Jetson | H.264 |
| AMediaCodec | Android hardware codecs | H.264 |
| OpenH264 | Any CPU (software) | H.264 |
| libjpeg | Any CPU (software) | JPEG |
| AVX2 | Intel/AMD x86_64 (Haswell+) | Colourspace conversion |
| CUDA | NVIDIA GPUs | Colourspace conversion |
MISRA Compliance¶
The src/ library code is analysed against MISRA C++:2023 with
THEMIS Lint (
themis-lint) as part of the build (make misra; make misrafix applies automatic corrections). The latest report
(version 2.0.0-rc4, 64 files, 25,350 lines analysed) has no open findings. Every deviation is a
misra-suppress override with an in-source justification, for example system-API casts and wire-packet overlays.
Why it matters for video¶
Video pipelines process untrusted network input at high rates: RTP/RTCP packets, SDP and RTSP text, and codec bitstreams. A single out-of-bounds read, integer overflow or use of uninitialised data in a depayloader can freeze a display, corrupt imagery or become a remotely exploitable fault. In vehicle, defence and industrial systems the picture can be safety- or mission-relevant (driver vision, targeting, situational awareness), so the library must behave predictably for years without surprises.
MISRA C++:2023 restricts the language to well-defined, analysable behaviour (no undefined or unspecified behaviour, explicit conversions, no hidden dynamic allocation or global state). That keeps latency and memory use bounded and makes the code easier to review and certify alongside DEF STAN 00-082 equipment.
Note
The lint results are indicative and are not a licensed reviewer's sign-off.
The full report and trend dashboard are in the repository under reports/. "MISRA" is a registered trademark of
HORIBA MIRA Limited, and use of the logo does not imply endorsement.
Quick Example¶
#include "rtp/rtp.h"
int main() {
mediax::RtpSapTransmit<mediax::rtp::uncompressed::RtpUncompressedPayloader> rtp(
"239.192.1.1", 5004, "my-stream", 640, 480, 30, "RGB24");
std::vector<uint8_t> &data = rtp.GetBufferTestPattern();
for (int i = 0; i < 1000; i++) {
rtp.Transmit(data.data(), false);
}
return 0;
}
License¶
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
Commercial licenses are available. Visit astutesys.com for more information.
Getting Help¶
- Documentation: You're reading it!
- Support: https://astutesys.com/support
- Email: support@astutesys.com
- GitHub Issues: Report a bug