What is libplacebo? The GPU renderer behind mpv's picture
What is libplacebo? Discover the GPU video rendering library powering mpv's gpu-next, VLC 4.0, and modern HDR tone mapping and Dolby Vision.
In short
- libplacebo is an open-source C library that executes video scaling, color management, and HDR tone mapping on GPU shaders.
- Originally spun off from mpv's core rendering code, it powers mpv's next-generation video output driver (gpu-next) and VLC 4.0.
- It includes mathematical algorithms for ITU-R BT.2390 tone mapping, debanding, dithering, and Dolby Vision dynamic metadata reshaping.
- MacLC integrates libplacebo algorithms and ports its Dolby Vision RPU parser to render dynamic HDR on Apple Silicon screens.
On this page
The software library libplacebo is an open-source, high-performance GPU video rendering and color management engine. Originally extracted from the internal rendering code of the mpv media player by developer Niklas Haas, it provides the mathematical algorithms that turn raw decoded video frames into accurate pictures on your display.
Whenever a modern video player scales a 1080p video up to a 4K screen, compresses a 4,000-nit HDR film to fit a dimmer monitor, removes color banding in dark gradients, or parses Dolby Vision dynamic metadata, it relies on GPU shaders. libplacebo packages these complex graphics routines into a reusable, cross-platform C library that powers modern video players across macOS, Linux, and Windows.
What is libplacebo and where did it come from?
In the early days of digital video, video players relied on simple CPU routines or fixed-function 2D graphics hardware to draw frames on a monitor. As screen resolutions jumped to 4K and 8K, and color standards expanded from standard 8-bit Rec. 709 to 10-bit wide color gamut Rec. 2020 with High Dynamic Range (HDR), basic display pipelines became obsolete.
The mpv player community pioneered high-end GPU shader rendering through its custom video output driver, known as vo_gpu. It allowed users to run advanced interpolation filters, anti-ringing algorithms, and customized tone curves using programmable graphics shaders.
However, because that rendering logic was tightly coupled to mpv’s internal code, other open-source projects—such as VLC media player and FFmpeg—could not easily use it. In 2017, lead developer Niklas Haas (known online as “haasn”) extracted mpv’s core rendering algorithms into an independent, modular C library named libplacebo.
Released under the GNU Lesser General Public License (LGPL-2.1-or-later), libplacebo is agnostic to the operating system or graphics API. It provides backends for Apple Metal on macOS, Vulkan on Linux and Android, Direct3D 11 on Windows, and cross-platform OpenGL.
Try it
Fitting a bright HDR film onto a dimmer screen
- As graded (a screen as bright as the film)
- Clipped
- Rolled off (BT.2390)
How does libplacebo handle HDR tone mapping on GPUs?
The most mathematically demanding task in modern video playback is tone mapping. A mastering studio might grade a 4K Ultra HD Blu-ray film on a reference monitor capable of producing 4,000 nits of peak brightness. However, typical computer monitors and laptop screens can only sustain between 400 and 1,000 nits.
If a video player clips any brightness value above the screen’s maximum capability, all detail in bright clouds, explosions, and illuminated faces is crushed to flat white. Conversely, if a player reduces the overall brightness uniformly, the entire movie looks dim and washed out.
libplacebo solves this dilemma by applying mathematical tone-mapping transfer functions directly inside GPU fragment shaders:
- ITU-R BT.2390 EETF (Electrical-Optical Transfer Function): The international broadcasting gold standard for HDR tone mapping. It preserves a linear 1:1 match for shadows and midtones while gradually rolling off specular highlights to match the display’s exact peak headroom without hard clipping.
- Spline and Hermite curves: Provides smooth cubic interpolation between mastering peak luminance and screen luminance, preserving highlight contrast without color shifts.
- Reinhard and Mobius mapping: Mathematical curves that compress wide dynamic ranges into standard dynamic range (SDR) luminance spaces with high efficiency.
In addition to brightness tone mapping, libplacebo performs color gamut mapping. When translating Rec. 2020 master footage onto a DCI-P3 MacBook display or an sRGB monitor, libplacebo computes colorimetric conversions in 64-bit floating-point precision, ensuring saturated neon colors do not distort hue angles or clip into muddy tones. To learn more about how tone curves work, read our dedicated guide on what is tone mapping.
What makes mpv’s gpu-next different from legacy vo_gpu?
If you use the mpv media player or modern macOS frontends like IINA, you have likely encountered discussions comparing vo=gpu to vo=gpu-next.
| Rendering Feature | Legacy mpv (vo=gpu) |
Next-Generation (vo=gpu-next via libplacebo) |
|---|---|---|
| Core Architecture | Monolithic C code embedded inside mpv | Modular library (libplacebo) with automated test suites |
| Color Precision | 16-bit / 32-bit float approximations | Full 64-bit float math with strict colorimetric accuracy |
| Dolby Vision Support | No dynamic metadata reshaping | Native Dolby Vision RPU parsing and metadata application |
| HDR Tone Mapping | Static tone mapping curves | ITU-R BT.2390 EETF, dynamic peak detection, spline rolloff |
| Debanding & Dithering | Basic spatial deband shader | High-precision temporal and spatial debanding with noise shaping |
| AV1 Film Grain | CPU software grain blending | Real-time GPU compute shader film grain synthesis |
For many years, vo=gpu was the standard video output driver in mpv. However, as HDR standards grew more complex, maintaining custom shader code directly inside mpv became unsustainable.
In response, the mpv team introduced vo=gpu-next. Instead of doing its own rendering math, gpu-next passes decoded video surfaces directly to libplacebo. This gives mpv users instant access to the latest tone-mapping algorithms, hardware-accelerated AV1 film grain synthesis, and full Dolby Vision dynamic metadata parsing. To learn how mpv runs on modern macOS systems, see our review of mpv on Mac.
How does libplacebo handle Dolby Vision dynamic metadata?
Standard HDR10 uses static metadata: one single maximum mastering value (MaxCLL) that applies to the entire two-hour movie. If a movie contains one bright outdoor scene at 1,000 nits and ninety minutes of dark dialogue scenes, static players tone-map the entire movie against that single 1,000-nit number, making dark scenes unnecessarily dim.
Dolby Vision solves this by embedding per-scene or per-frame dynamic metadata in an ancillary data stream called the Reference Processing Unit (RPU). The RPU tells the player the exact minimum, midtone, and peak brightness of every individual shot.
Historically, reading and applying Dolby Vision RPU metadata required proprietary commercial silicon licensed from Dolby Laboratories. Open-source players were forced to discard the dynamic metadata and fall back to the basic HDR10 base layer.
libplacebo broke this limitation by implementing an open-source parser and reshaping algorithm for Dolby Vision RPU metadata. In real time on the GPU, libplacebo:
- Reads the polynomial coefficients and lookup tables encoded in the RPU bitstream.
- Reshapes the nonlinear 12-bit IPTPQc2 or YCbCr color surfaces into standard linear RGB coordinates.
- Applies dynamic per-shot tone curves tailored specifically to the measured peak brightness of the connected display.
This allows computer displays to show Dolby Vision films with scene-by-scene brightness adaptation without proprietary hardware chips.
How VLC 4.0 and modern players use libplacebo
Because libplacebo was designed from the start as a modular, standalone library, other major media projects have adopted it into their rendering architectures.
The upcoming VLC 4.0 overhaul from VideoLAN completely replaces VLC’s legacy video output modules with a modernized pipeline built on libplacebo (modules/video_output/libplacebo/). This integration brings high-precision GPU color management, accurate HDR-to-SDR tone mapping, and modern scaling filters to VLC for the first time.
MacLC’s own Metal renderer carries a port of libplacebo’s Dolby Vision decoder, and works with the rest of the Mac’s display path:
- Metal integration: Decoded video buffers pass through high-speed Metal compute shaders, minimizing overhead.
- Dynamic display adaptation: When you move a movie window between a built-in Liquid Retina XDR screen (capable of 1,600 nits peak HDR) and an external SDR monitor, the player adapts its tone-mapping curves.
- Picture styles: Users can select between Accurate (strict mastering match), Balanced (ITU-R BT.2390 highlight rolloff), and Bright (elevated scene luminance for bright rooms) in Settings › HDR & Colour.
To understand how scaling filters like Lanczos and Spline interact with GPU rendering, read our guide to video scaling filters explained.
What to do next
The rise of libplacebo represents a major milestone in open-source video engineering. By standardizing high-end GPU rendering algorithms into a shared library, it allows modern media players to deliver picture quality that rivals expensive mastering hardware.
If you want to experience the benefits of advanced GPU rendering and dynamic Dolby Vision tone mapping on your Apple Silicon Mac, try MacLC. MacLC fits each HDR film to the screen it is on, with the picture style you choose.
Questions people ask
What is libplacebo used for?
libplacebo is used by media players like mpv and VLC to render video on graphics processors (GPUs). It handles image scaling, color space conversions, debanding, dithering, and HDR-to-SDR tone mapping via GPU compute shaders.
What is the difference between gpu and gpu-next in mpv?
In mpv, vo=gpu is the legacy video output driver written directly inside mpv's codebase. vo=gpu-next replaces it by routing the entire rendering and color pipeline through the standalone, actively maintained libplacebo library.
Does libplacebo support Dolby Vision?
Yes. libplacebo includes native parsing and mathematical reshaping for Dolby Vision dynamic metadata (Reference Processing Unit / RPU), mapping dynamic per-scene tone curves to standard displays.
Is libplacebo available on macOS?
Yes. libplacebo runs natively on macOS through Apple's Metal framework, Vulkan (via MoltenVK), and OpenGL 4.1. It is available via Homebrew with brew install libplacebo.