mdk 与 ffmpeg 库是运行时必需项,分发时必须一并带上;字幕渲染需额外附带 libass,AV1 软解需额外下载 libdav1d;macOS 默认 Hardened Runtime 下可能因 framework 内 dylib 未签名而无法运行,需关闭库校验或自行签名;Android 上必须先调用 SetGlobalOption("JavaVM", JvmPtr)。
include(${MDK_SDK_DIR}/lib/cmake/FindMDK.cmake)
target_link_libraries(your_target PRIVATE mdk)README 未给出具体显存或 GPU 型号要求,硬件解码器按平台区分(Windows 用 MFT/D3D11/DXVA/CUDA,Linux 用 VAAPI/VDPAU/CUDA,Android 用 AMediaCodec,树莓派用 V4L2M2M,瑞芯微用 rockchip/rkmpp);具体系统要求见 wiki 的 System Requirements 页。
跨平台多媒体播放 SDK,提供统一 API 做硬件解码与 GPU 零拷贝渲染
跨平台多媒体开发套件,提供 Dolby Vision、HDR、D3D12、Metal 等硬件加速解码与播放能力,方便在各类设备上集成高质量视频处理。
核心能力
- 提供简洁统一的 Player API,覆盖播放全流程
- 全平台硬件加速解码器,含 Windows、Linux、Android、Apple
- 全平台零拷贝 GPU 渲染,支持 D3D11/12、Metal、OpenGL
- 支持 HDR 元数据透传与 HDR/SDR 色调映射
- 支持杜比视界 Profile 5 与 Profile 7 FEL 解码渲染
容易踩的坑
- v0.40.1最新正式版2026-11-06 · 2026-11-06 07:53 UTC
- AMediaCodec:
- Unify asynchronous output consumption and buffer release; remove release worker
- Consume synchronous output events within a total timeout
- Fix decoder EOS submission and output cleanup
- DiskCache:
- Forward IO options before open
- Preserve timeout before opening the URL
- cmake: RUNPATH fix for cmake 4.0+
- AMediaCodec:
- v0.40.02026-11-04 · 2026-11-04 06:54 UTC
查看更新说明
- Subtitle:
- Add global option
subtitle.seek_on_switchfor embedded subtitles, default 1 - Add
subtitle.delayproperty, value is a floating point string, unit is second - Fix pending style changes being discarded, styles not applied before play
- Improve bitmap lookup
- Add global option
- GPU:
- Support
VideoEffectfor dolby vision profile 5 - Fix hgl linearization
- Adapt hlg peak to hdr target
- Fix dolby vision color if previous video is uyvy format
- Fix Hap uncompressed data rendering
- Support
- BRAW:
- Build with 6.0 SDK, not compatible with old versions
- Support windows arm64
- MFT:
- Add
buffersproperty for sample output - Add
verboseproperty to show more logs, can be 0, 1(default), 2
- Add
- Improve video decoder enhancement layer decoding & dovi/gainmap/raw meta data
- OpenGL:
- Enable yuv sampler by default
- Fix yuv sampler wrong shader code
- Fix gl yuv sampler selection for rgb hardware buffers, e.g. some av1 decoded from AMediaCodec can not be rendered
- Fix crash when resizing a Cocoa window if context is created internally
- AMediaCodec: output ASAP and fix sync mode stalls if a packet can not be consumed
- OH video decoder: fix callback UAF, e.g. repeated seeks followed by stop.
- Fix video freezing or persistent flicker after pausing playback, turning the screen off, unlocking, and resuming(android)
- Fix metal drawable(if created internally) leaks
- Fix dead loop if a packet is not consumed by decoder (fvp#410)
- AAudio: fix state transition, fail to resume playback
- Skip EOF waits for cached tracks without decoder threads to prevent hangs after late subtitle activation
- Reduce cpu load when paused
- FFmpeg:
- Choose the closest lowres if scale property is
${W}x${H} - Drain frames before resending a packet on EAGAIN
- Choose the closest lowres if scale property is
- Subtitle:
- v0.39.02026-09-30 · 2026-09-30 03:13 UTC
查看更新说明
- API:
- Add
VideoLayers, andsetLayers()(setVideoLayers()in C) for rendering the base layer, enhancement layer or all layers.
- Add
- Dolby Vision Profile 7 FEL support:
- Decode FEL from single-track and separate base/enhancement tracks
- Render FEL residuals with Metal, OpenGL/ES, Vulkan, D3D11 and D3D12.
- FFmpeg 9.0+ is required for separated bl/el tracks or if no in-band parameter sets
- HDR Gain Map support:
- Parse gain map in jpeg, support ISO 21496-1, adobe, google and apple xmp
- Apply decoded maps for HDR presentation with Metal, D3D11, D3D12, OpenGL/GLES and Vulkan if hdr is supported, or you can use global option
gpu.gainmap.sdr=1to apply for sdr display too.
- GPU renderers:
- Simplify dolby vision reshape.
- Improve enhancement layer rendering. Now alpha layer, gain map and dolby vision fel are treated as enhancement layer.
- Unify base layer and enhancement layer rendering. Both can be produced from hardware decoders and support 0-copy.
- Enhancement layer options:
- Decoder property:
el.$prop(except el.decoder) will apply$propfor el decoder only. - Player property
demux.el.attachanddemux.el.passcontrol multi-track packet pairing and passthrough.
- Decoder property:
- MFT: default JPEG decode output to NV12 and reject unsupported output-format mismatches. This can exclude jpeg 444, it's expected because the result can be wrong for high resolution images. MFT bug?
- VT:
- "verbose" property to print session and frame details. value can be 0, 1, 2
- Preserve complete parameter sets across seek
- Preserve NAL framing across reactive restart
- Support single-track FEL w/o el hvcC
- OH video decoder: stop decoder when no buffer lives to fix single frame jpeg image can not be rendered
- Decoder option change:
el,alpha,rawint value can be -1(default): prefer backend, 0: disable, 1: backend only, 2: built-in parser or dual decoder only. - Extract base layer extra data if an el decoder is required.
- GL:
- Fix EGL platform apis attribute type in EGL 1.4~1.5, broken since 7 years ago.
- Fix drm external oes target binding
- Fix invalid timestamp duration and full-file buffering
- Video encoders(no api yet):
- Add VT encoder
- Support input resolution changes for h264/5, including coded-stream framing and parameter-set updates.
- Android:
- Retain native windows across surface changes, fix UAF in gl context
- Improve JNI thread safety, performance etc
- WGL:
- scRGB output support, must explicitly call Player.set(ColorSpaceSCRGB)
- Fix shared/offscreen WGL context creation.
- AudioQueue: support multichannel formats negotiated with the output device.
- Fix snapshot failed to encode jpeg
- FFmpeg:
- Fix AVPacket pts broken since previous version
- Support AVStreamGroup, used by dolby vision fel
- Guess color space, fix scale error
- API:
- v0.38.02026-08-11 · 2026-08-11 03:22 UTC
查看更新说明
- Support hevc frame size change in all decoders
- Smooth playback, better A/V sync
- AMediaCodec:
- Enable tunnel if surface property is a valid ptr, previously
image=0is also required - Enable dolby vision by default for tunnel mode
- Use java implementation for AMediaCodecStore for api < 37. https://github.com/wang-bin/mdk-sdk/issues/365
- Fix async mode buffer release dead lock
- Fix stale states when flushing
- Enable tunnel if surface property is a valid ptr, previously
- OHOS: add x86_64, improve ohaudio renderer
- AAudio:
- Fix invalid state when flushing
- Improve timing
- XAudio2: fix use after free when flushing
- Improve subtitle rendering, requires libass from https://nightly.link/wang-bin/devpkgs/workflows/build/main/libmdk-dep.zip
- Apple: font face w/o font path to support new format not supported by freetype
- OHOS: supports system fonts
- Compile time pixel formats description
- Implement gpu timer for d3d12, metal and vulkan renderer
- Fix audio frame samples per channel
- Android: fix ANR if accurate seek
- Metal: fix constant buffer layout, e.g. dovi profile8 mmr
- Disable tone mapping if in & out signal peak are close, also fix bt2390 shader
- Parse rpu even if dolby vision profile is unknown
- EGL: Choose 8bit color format for SDR because rgb10a2 may be not well supported on some devices
- Muxer: detect DTS decrease
- Fix
onXXX(nullptr)null callback clearing, fix dead lock inonSync(null)when playing - Fix subsample size for odd size
- Global option
log.codec_list=0can disable enumerating supported codecs(once) for AMediaCodec and OH decoder - FFmpeg:
- Improve v9 ABI support
- Fix HEVC alpha decode with recent FFmpeg
- Encoder keeps input frame size by default, support size change
- Support complex filter graph, multiple input tracks as input via
setActiveTracks() - Support hw filters for sw frames via
hwupload, optionally hw devices can be set byvideo.avfilter.hwdevice. FFmpeg 6.0+ is required. see wiki for more details - More pixel formats
- Linux sdk is built with clang-24
- v0.37.02026-06-30 · 2026-06-30 15:36 UTC
查看更新说明
- Support ProRes Raw color parameters parsing and rendering for all decoders and renderers.
- Disk cache support for http(s), default cache dir is OS or app cache dir. Can be enabled by global option
cache.disk.io=1, change protocols viacache.disk.io.protocols=proto1,proto2, change cache dir viacache.disk.io.dir - Support h264/5 decoder frame drop, improve seek speed
- Video decoder property
dropvalue can beno,nonref,bidir,noni,nonkeyandauto(default) - Drop frames to keep playback rate for intra only codecs e.g. hap. can be disabled by decoder property
drop_fps=0 - Support decoder frame drop if out of sync. For playback rate >= 3.0, it's enabled. drop count is show in log.
- If a decoder support scaled output, default size is max video renderer size, result in higher decoding speed. Can be enabled(default) by player property
video.decoder.scalevaluevo, disabled by other values. - GPU:
- Support bayer formats, 8~16 bits, all patterns, including OpenGL ES2
- Support ProRes Raw rendering with color correction
- Fix uniform/const buffer struct member alignment, especially for metal msl
- VT decoder:
scaleproperty value can be${w}x${h}or1/N, a closest supported size will be used. Improve scale support check.- ProRes Raw now outputs bayer format by default for macOS 11.0+ and iOS 14.0+, higher performance, no scale support. Still output rgbaf16 if bayer is not supported.
- OHOS:
- More codecs in api 23 and 24
- Bundle dav1d in sdk
- Support raw file resources via
rawfile:some_path, requires global optionresourceManager. native example and flutter example
- CUDA:
- Prefer primary context. can be disabled by global option
cuda.primaryCtx=0or envCUDA_PRIMARY_CTX=0 - Enable for WOA64
- Support 422(not tested)
- Prefer primary context. can be disabled by global option
- Ensure snapshot is executed when a frame is rendered
- Slow down audio speed if video is too slow, can be enabled by global option
avsync.audio.adaptive=1 - Default font dir is in app cache dir for android and ohos
- OpenGL: Fix crash if snapshot without a video frame
- Add vulkan to
decoders.hintfor desktop platforms - XAudio2: destroy engine when player destroyed to fix preventing system hibernation. env
XA2_SHARED=1or global optionaudio.xa2.persistent=1can keep engine alive to speedup device switch. - Fix potential hang when destroying player
- Fix play again w/o stop may result in dead lock
- Fix sync to external clock via
onSync()when seeking or state changed. - Don't convert mono pcm if marked as planar format
- R3D:
- Build against 9.2 SDK
- Support windows on arm64
- Disable unsupported features
- FFmpeg:
- Compatible with 9.0 abi
- Fix in/out pts mismatch
- More pixel formats support
- Check requirements for compute shader based vulkan decoders to avoid driver crash
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Download latest Nightly Build SDK from sourceforge or github actions
Sourceforge
Github Releases
NuGet
Features
- Simple and powerful API set
- Cross platform: Windows(x86, arm), UWP, Linux, macOS, Android, OpenHarmony, iOS, tvOS, visionOS, Raspberry Pi, RockChip
- Hardware accelerated decoders for all platforms
- 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 metadata passthrough, HDR <=> SDR tone mapping. You can use HDR display in Qt6(6.6+ for macOS, 6.x for windows), OBS Studio, Android SurfaceView and more.
- Dolby Vision decoding and rendering, including Profile 5, Profile 7 FEL. Support HEVC and AV1.
- HDR gain map support.
- HEVC, VP8/9 transparent videos(alpha channel) support for all decoders and renderers
- Professional codecs: GPU accelerated HAP codec rendering, higher HAP compression ratio and decoding speed, ProRes Raw rendering, Blackmagic RAW, R3D, N-RAW, nvJPEG2000
- Subtitle rendering, including ass, plain text, bitmap, closed caption. Support apple new font formats, android and ohos system fonts
- 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
- Smart FFmpeg runtime, dynamic load, binary compatible with 4.0~9.x
Install
CMake
include(${MDK_SDK_DIR}/lib/cmake/FindMDK.cmake)
target_link_libraries(your_target PRIVATE mdk)
Qt qmake
include($$MDK_SDK_DIR/mdk.pri)
CocoaPods
(Objective-)C/C++ Users
pod 'mdk'
Optionally you can use mdk.xcframework directly.
Swift Users
Add swift-mdk via swift package manager, or
pod 'swift-mdk'
and
import swift_mdk
Nuget
Install via NuGet in Visual Studio for both Windows desktop and UWP
OpenHarmony
ohpm install @mediadevkit/libmdk-napi
macOS Hardened Runtime
You may fail to run(or codesign) with default hardened runtime options because there are some dylib files in mdk.framework not signed correctly. You can either select Disable Library Validation in Hardened Runtime options, or sign dylib(RECOMMENDED): In Build Phase, add a New Run Script Phase with content
[ -n "$CODE_SIGN_IDENTITY" ] && find "$BUILT_PRODUCTS_DIR" -depth -path "*mdk.framework/*" -name "lib*.dylib" -exec codesign -f -vvvv -s"${EXPANDED_CODE_SIGN_IDENTITY}" ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements,flags {} \;
Distribute
- mdk(libmdk.so.0/ibmdk.dylib/mdk.dll) and ffmpeg library(or standard ffmpeg libraries) are always REQUIRED
- libass.dll/libass.dylib/ass.framework/libass.so can be optional if not using subtitle rendering
- mdk-braw.dll/libmdk-braw.{so,dylib}: optional, for blackmagic raw videos
- mdk-r3d.dll/libmdk-r3d.{so,dylib}: optional, for RED raw and N-RAW videos
- mdk.pdb/libmdk.so*.dsym: debug symbols.
- Add libdav1d.dll/libdav1d.dylib/dav1d.framework/libdav1d.so to support av1 software decoding
Documents
- wiki
- sdk headers
Recommended settings
Since 0.35.0, player.setProperty("video.decoders", GetGlobalOption("video.decoders.hint")) will prefer hardware decoders over software ones, and the following player.setDecoders() is not required.
- macOS, iOS:
player.setDecoders(MediaType::Video, {"VT", "hap", "FFmpeg", "dav1d"}); - Windows:
player.setDecoders(MediaType::Video, {"MFT:d3d=11", "D3D11", "DXVA", "CUDA", "hap", "FFmpeg", "dav1d"}); - 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 hardware decoder and use EGL for 0-copy rendering
player.setDecoders(MediaType::Video, {"V4L2M2M", "FFmpeg:hwcontext=drm", "FFmpeg", "dav1d"});
- RockChip: mdk-sdk-linux.tar.xz contains a rockchip decoder plugin. You can also use ffmpeg's
rkmppdecoder: deletelibffmpeg.so.*and use upstream ffmpeg or ffmpeg-rockchip with rkmpp enabled. OpenGL ES2/3 0-copy rendering is supported
SetGlobalOption("gl.ubo", "0"); // optional. required by some buggy drivers
player.setDecoders(MediaType::Video, {"rockchip", "rkmpp", "FFmpeg", "dav1d"});
- Android:
SetGlobalOption("JavaVM", JvmPtr); // REQUIRED
player.setDecoders(MediaType::Video, {"AMediaCodec", "FFmpeg", "dav1d"});
Open Source
Modules and Dependencies
- License generator and validator
- Android java wrapper and example
- MediaFoundation decoder module
- av1 software decoder module
- sunxi decoder + renderer
- GFX surface and render loop
- JNI C++ api
- Android java and jni APIs in C++
- C++ TLS
- C++ compatibility layer
- cmake tools
- Blackmagic RAW
- R3D RAW, N-RAW
- nvJPEG2000
- rockchip
Examples and Plugins for Other Frameworks
- examples for different platforms and gui toolkits
- Swift player and QuickLook plugin for macOS
- obs-studio video source plugin
- as a qtmultimedia plugin
Language Bindings
Sponsors
Users
Q-SYS UCI Viewer Diem easy live tv Kazumi 金嵘达科技 爱玩宝
License
- Free for opensource projects, QtAV donors and contributors: you can acquire a key from me. Can be commercial software
- Free for Flutter users. A key is already included. Can be commercial softwares.
- Free for other non-commercial users: you can acquire a key from me.
- Commercial license for other users: a key for an app for a single platform or multiple platforms.
- Other users without a key: make sure your sdk is updated, otherwise you may see an QR image in the last frame.
License key generator and validator is open source











