Hardware Acceleration¶
MediaX supports hardware-accelerated video encoding and decoding on a variety of platforms and GPU hardware.
Supported Platforms¶
| Platform | Architecture | Status |
|---|---|---|
| Ubuntu 22.04 | amd64 | ✅ Supported |
| Ubuntu 24.04 | amd64 | ✅ Supported |
| Raspbian 12 | arm64 | ✅ Supported |
| NVIDIA Jetson | arm64 | ✅ Supported |
Acceleration Backends¶
MediaX uses native backends to access hardware encoders and decoders. The following backends are available depending on your hardware:
| Backend | API | Hardware | Codecs |
|---|---|---|---|
| VAAPI | libva direct | Intel (6th gen+), AMD (GCN 3+) | H.264, H.265, AV1 |
| OpenH264 | Software | Any CPU | H.264 |
| AVX2 | Intel SIMD | Intel/AMD x86_64 CPUs (Haswell+) | Colourspace |
| CUDA | NVIDIA GPU | NVIDIA GPUs | Colourspace |
Platform / Backend Matrix¶
| Backend | Ubuntu 22.04 | Ubuntu 24.04 | Raspbian 12 | Jetson |
|---|---|---|---|---|
| VAAPI (Intel) | ✅ | ✅ | — | — |
| VAAPI (AMD) | ✅ | ✅ | — | — |
| OpenH264 (SW) | ✅ | ✅ | ✅ | ✅ |
| AVX2 (colourspace) | ✅ | ✅ | — | — |
| CUDA (colourspace) | ✅ | ✅ | — | ✅ |
CMake Build Options¶
Enable hardware acceleration at build time:
# Intel/AMD VAAPI
cmake -DVAAPI_SUPPORTED=ON ..
# CUDA colourspace acceleration
cmake -DBUILD_CUDA=ON ..
# All options combined
cmake -DVAAPI_SUPPORTED=ON -DBUILD_CUDA=ON ..
Intel VAAPI Setup¶
Install Drivers¶
# Ubuntu 22.04 / 24.04
sudo apt install -y \
intel-media-va-driver \
libva-dev
Verify Installation¶
# Check VA-API support
vainfo
Usage¶
#include "h264/vaapi/rtp_h264_vaapi_payloader.h"
#include "h265/vaapi/rtp_h265_vaapi_payloader.h"
// H.264 with VAAPI
mediax::rtp::h264::vaapi::RtpH264VaapiPayloader h264_payloader;
// H.265 with VAAPI
mediax::rtp::h265::vaapi::RtpH265VaapiPayloader h265_payloader;
Native VAAPI AV1¶
MediaX includes a native VAAPI AV1 backend that uses libva directly. This is automatically built when CMake detects libva (LIBVA_FOUND).
Requirements¶
- Decode: Intel 11th gen+ or AMD RDNA2+
- Encode: Intel 12th gen+ or AMD RDNA3+
Verify Support¶
# Check for AV1 profiles
vainfo 2>&1 | grep -i av1
# You should see entries like:
# VAProfileAV1Profile0 : VAEntrypointVLD (decode)
# VAProfileAV1Profile0 : VAEntrypointEncSliceLP (encode)
Usage¶
#include "av1/vaapi/rtp_av1_vaapi_payloader.h"
#include "av1/vaapi/rtp_av1_vaapi_depayloader.h"
// AV1 encode + transmit (native VAAPI)
mediax::rtp::av1::vaapi::RtpAv1VaapiPayloader av1_payloader;
// AV1 receive + decode (native VAAPI)
mediax::rtp::av1::vaapi::RtpAv1VaapiDepayloader av1_depayloader;
// Check availability at runtime
if (mediax::rtp::av1::vaapi::RtpAv1VaapiPayloader::IsVaapiAvailable()) {
// Hardware AV1 encoding is available
}
Performance Comparison¶
Typical encoding performance for 1920×1080 @ 30fps:
| Method | CPU Usage | Latency | Notes |
|---|---|---|---|
| OpenH264 (software) | ~60% | ~30ms | Any platform |
| VAAPI (Intel) | ~5% | ~10ms | Requires Intel GPU |
Note
Actual performance varies with resolution, framerate, bitrate, and hardware generation.
CUDA Colourspace Acceleration¶
MediaX can use CUDA for GPU-accelerated colourspace conversions (RGB ↔ YUV, scaling, etc.) independently of video codec acceleration:
cmake -DBUILD_CUDA=ON ..
Supported conversions include:
- RGB24 ↔ YUV422
- RGB24 ↔ Mono8/Mono16
- NV12 → BGRA / RGB
- YUV → ARGB
- Bilinear scaling (BGRA)
CUDA acceleration requires an NVIDIA GPU and the CUDA toolkit.
AVX2 Colourspace Acceleration¶
On x86_64 platforms (Ubuntu 22.04/24.04), MediaX automatically detects AVX2 support at runtime and uses SIMD-accelerated colourspace conversions when available. No build flags are required — AVX2 is compiled as a separate object library with -mavx2 and dispatched via CPUID at startup.
AVX2-accelerated functions:
| Function | Description |
|---|---|
YuvToRgb |
YUV 4:2:2 (UYVY) → RGB24 |
YuvToBgra |
YUV 4:2:2 (UYVY) → BGRA |
RgbToYuv |
RGB24 → YUV 4:2:2 (UYVY) |
RgbaToBgra |
RGBA → BGRA channel swap |
RgbToBgra |
RGB24 → BGRA |
Mono8ToBgra |
Greyscale 8-bit → BGRA |
On CPUs without AVX2 (or on ARM platforms), these functions automatically fall back to the optimised scalar CPU implementation. No application code changes are needed.
Platform Availability¶
| Platform | AVX2 Status |
|---|---|
| Ubuntu 22.04 (amd64) | ✅ Auto-detected |
| Ubuntu 24.04 (amd64) | ✅ Auto-detected |
| Raspbian 12 (arm64) | — Not available |
| NVIDIA Jetson (arm64) | — Not available |
Troubleshooting¶
No Hardware Acceleration Detected¶
- Verify driver installation with
vainfo - Ensure the correct CMake option is enabled (
-DVAAPI_SUPPORTED=ON)
Fallback to Software Encoding¶
If hardware encoding fails, MediaX falls back to OpenH264 software encoding. Check build output for warnings about missing hardware support.
VAAPI Permission Denied¶
# Add user to video and render groups
sudo usermod -aG video,render $USER
# Log out and back in
Support¶
- Website: https://astutesys.com/support
- Email: support@astutesys.com