mdk-sdk

wang-bin活跃维护

跨平台多媒体开发套件,提供 Dolby Vision、HDR、D3D12、Metal 等硬件加速解码与播放能力,方便在各类设备上集成高质量视频处理。

multimedia development kit. download:

v0.40.1发布于 2026-11-06 07:53 UTC429star50fork同步于 2026-11-10 12:00 UTC

怎么上手

由 README 提炼,执行前请确认
include(${MDK_SDK_DIR}/lib/cmake/FindMDK.cmake)
target_link_libraries(your_target PRIVATE mdk)
硬件要求按 README 说明

README 未给出具体显存或 GPU 型号要求,硬件解码器按平台区分(Windows 用 MFT/D3D11/DXVA/CUDA,Linux 用 VAAPI/VDPAU/CUDA,Android 用 AMediaCodec,树莓派用 V4L2M2M,瑞芯微用 rockchip/rkmpp);具体系统要求见 wiki 的 System Requirements 页。

需要 CUDA
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

跨平台多媒体播放 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 解码渲染

容易踩的坑

mdk 与 ffmpeg 库是运行时必需项,分发时必须一并带上;字幕渲染需额外附带 libass,AV1 软解需额外下载 libdav1d;macOS 默认 Hardened Runtime 下可能因 framework 内 dylib 未签名而无法运行,需关闭库校验或自行签名;Android 上必须先调用 SetGlobalOption("JavaVM", JvmPtr)。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.40.1
  1. 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+
  2. v0.40.02026-11-04 · 2026-11-04 06:54 UTC
    查看更新说明
    • Subtitle:
      • Add global option subtitle.seek_on_switch for embedded subtitles, default 1
      • Add subtitle.delay property, value is a floating point string, unit is second
      • Fix pending style changes being discarded, styles not applied before play
      • Improve bitmap lookup
    • GPU:
      • Support VideoEffect for 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
    • BRAW:
      • Build with 6.0 SDK, not compatible with old versions
      • Support windows arm64
    • MFT:
      • Add buffers property for sample output
      • Add verbose property to show more logs, can be 0, 1(default), 2
    • 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
  3. v0.39.02026-09-30 · 2026-09-30 03:13 UTC
    查看更新说明
    • API:
      • Add VideoLayers, and setLayers() (setVideoLayers() in C) for rendering the base layer, enhancement layer or all layers.
    • 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=1 to 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 $prop for el decoder only.
      • Player property demux.el.attach and demux.el.pass control multi-track packet pairing and passthrough.
    • 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, raw int 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
  4. 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=0 is 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
    • 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 in onSync(null) when playing
    • Fix subsample size for odd size
    • Global option log.codec_list=0 can 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 by video.avfilter.hwdevice. FFmpeg 6.0+ is required. see wiki for more details
      • More pixel formats
    • Linux sdk is built with clang-24
  5. 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 via cache.disk.io.protocols=proto1,proto2, change cache dir via cache.disk.io.dir
    • Support h264/5 decoder frame drop, improve seek speed
    • Video decoder property drop value can be no, nonref, bidir, noni, nonkey and auto(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.scale value vo, 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:
      • scale property value can be ${w}x${h} or 1/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 option resourceManager. native example and flutter example
    • CUDA:
      • Prefer primary context. can be disabled by global option cuda.primaryCtx=0 or env CUDA_PRIMARY_CTX=0
      • Enable for WOA64
      • Support 422(not tested)
    • 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.hint for desktop platforms
    • XAudio2: destroy engine when player destroyed to fix preventing system hibernation. env XA2_SHARED=1 or global option audio.xa2.persistent=1 can 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

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Build status github

    Build Status

    Download latest Nightly Build SDK from sourceforge or github actions

    SourceforgeSourceforge Github ReleasesGithub Release NuGetNuGet

    Changelog. API

    Features

    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

    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"});
    
        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

    Examples and Plugins for Other Frameworks

    Language Bindings

    Sponsors

    Sportimization

    Users

    Sportimization Flyability Quipu GyroFlow www.connecting-technology NOTIONTHEORY

    teleguard! DaKanji Pimosa NovaStar digibird XStar CX1 onbon thinkshow NeoStation

    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