- Simple and powerful API set
- Cross platform: Windows(x86, arm), UWP, Linux, macOS, Android, iOS, tvOS, visionOS, Raspberry Pi
- Hardware accelerated decoders
- 0-copy GPU rendering for all platforms and all renderers(Vulkan is WIP.)
- Dynamic OpenGL
- OpenGL, D3D11, D3D12, Vulkan and Metal rendering w/ or w/o user provided context
- Integrated with any platform native ui apps, gui toolkits or other apps via OpenGL, D3D11/12, Vulkan and Metal (WinUI3, OBS, Flutter, Qt, SDL, GLFW, SFML, .NET Avalonia etc.) easily
- HDR display, HDR to SDR and SDR to HDR tone mapping. You can use HDR display in Qt6(6.6+ for macOS, 6.x for windows), OBS Studio and more.
- Dolby Vision rendering, including Profile 5. Support HEVC and AV1.
- Seamless/Gapless media and bitrate switch for any media
- Optimized Continuous seeking. As fast as mpv, but much lower cpu, memory and gpu load. Suitable for timeline preview
- Subtitle rendering, including ass, plain text, bitmap, closed caption
- Smart FFmpeg runtime, dynamic load, binary compatible with 4.0~7.x
- Professional codecs: GPU accelerated HAP codec rendering, Blackmagic RAW, R3D, nvJPEG2000
SDK is built by clang 20 with
- ffmpeg: https://sourceforge.net/projects/avbuild/files/linux/ffmpeg-master-linux-clang-lite-lto.tar.xz/download
- libc++ 20. You can use delete libc++.so from sdk and use system libc++
SDK can be used by any C or C++11 compiler, e.g. g++, clang
dsym files are debug symbols, not required to deploy your programe.
ubuntu>=14.04(maybe 12.04)
- glibc >= 2.14
- libc++1, libc++abi1: not using gnu stl because libc++ has better compatibility. previous sdks depend on glibc++ 3.4.22(g++6)
- libva version 2 or 1: libva2, libva-x11-2, libva-drm2 or libva1, libva-x11-1, libva-drm1. Running
apt install vainfo
will install these - libasound2, libpulse0
- libwayland-client0
- libgbm1
- libgl1-mesa-glx
Optional:
- libegl1-mesa: egl context
- libvdpau1: vdpau rendering. (required by ffmpeg decoder)
- libwayland-egl1: wayland surface and egl context support
- libass5~9 to support subtitle
- libopenal1
- libsdl2: sdlplay example
- GL_EGL: 0 = use glx context, 1 = use egl context (if created by mdk)
- GL_ES: 0 = use opengl, 1 = use opengl es (if created by mdk)
- VDPAU_GL: video = interop with video surface, output = interop with output surface, pixmap = interop with x11 pixmap(required by egl from x11)
- VAAPI_GL: x11 = interop with glx/egl(via x11 pixmap), drm = interop with drm prime, drm2 = interop with drm prime2
- CUDA_STREAM: 0/1
- CUDA_PBO: 0/1
- CUDA_HOST: 0/1
- CUDA_DEVICE: number
- OpenGL
- OpenGL ES2/3: via EGL, GLX, ANGLE or others. the default if EGL is available.
- Vulkan: broken now
- FFmpeg, VDPAU, VAAPI, CUDA, QSV(not tested), NVDEC
- command line: -c:v decodername
RaspberryPi OS system ffmpeg provides hevc and v4l2m2m drm_prime frame output, you can use system ffmpeg(delete libffmpeg.so.* in sdk package) with OpenGLES(desktop GL does not support hevc) contexts created from EGL to get maximum performance. glfwplay option to test:
- x11:
./glfwplay -c:v V4L2M2M,FFmpeg:hwcontext=drm:sw_fallback=1 -gl test.mp4
- wayland:
./glfwplay -c:v V4L2M2M,FFmpeg:hwcontext=drm:sw_fallback=1 -es test.mp4
, you have to install glfwsudo apt install libglfw3-wayland
RaspberryPi OS rendering performance is poor, you may have to disable log, log to file or minimize terminal to get higher fps, otherwise rendering log may slow down video rendering. wayland environment has better performance
GL Context
- Created by MDK: glfwplay -gl:opengl=1, glfwplay -gl:opengl=1:egl=1, glfwplay -gl, mdkplay, x11win
- Foreign Context: glfwplay, multiplayers, multiwindows (via glfw), sdlplay(via sdl)
Gapless Playback for Any Media:
- mdkplay(or glfwplay/window/sdlplay) file file2 ...
N players for 1 video: multiplayers -share -win N url
N videos and N players: multiplayers -share url1 url2 ... urlN
N videos renderers for 1 player: multiwidnows url
include(mdk-sdk-dir/lib/cmake/FindMDK.cmake)
target_link_libraries(your_target PRIVATE mdk)
include($$MDK_SDK_DIR/mdk.pri)
- Linux:
// XInitThreads(); // If using x11. before any x11 api call. some gui toolkits already call this, e.g. qt, glfw
SetGlobalOption("X11Display", DisplayPtr); // If using x11. Requred by VAAPI, VDPAU
player.setDecoders(MediaType::Video, {"VAAPI", "VDPAU", "CUDA", "hap", "FFmpeg", "dav1d"});
- Raspberry Pi: use mdk-sdk-linux.tar.xz, delete libffmpeg.so.* to use system ffmpeg to support h264, hevc hardware decoder and 0-copy rendering
player.setDecoders(MediaType::Video, {"V4L2M2M", "FFmpeg:hwcontext=drm", "FFmpeg"});
- some examples using mdk sdk
- OBS Studio plugin
- QtMultimedia plugin
- MFT decoder module
- dav1d decoder module
- Blackmagic RAW
- R3D RAW
Copyright (c) 2016-2024 WangBin(the author of QtAV) Free for opensource softwares, non-commercial softwares, flutter, QtAV donors and contributors.