aboutsummaryrefslogtreecommitdiff
path: root/modules/home/media/mpv
diff options
context:
space:
mode:
authorLeander Scherer <leander@schererleander.de>2026-01-13 00:29:14 +0100
committerLeander Scherer <leander@schererleander.de>2026-01-13 00:29:14 +0100
commit62dce237042df87aafd76e706cf74aa3523bf7a5 (patch)
tree9114eab72489e7d3971694cc4a2cbc8cf240d76f /modules/home/media/mpv
parent3b5a73c436eb22e0cda59469263490705e149cb9 (diff)
feat(mpv): setup sdr to hdr mpv
Diffstat (limited to 'modules/home/media/mpv')
-rw-r--r--modules/home/media/mpv/default.nix67
1 files changed, 67 insertions, 0 deletions
diff --git a/modules/home/media/mpv/default.nix b/modules/home/media/mpv/default.nix
new file mode 100644
index 0000000..f6ac360
--- /dev/null
+++ b/modules/home/media/mpv/default.nix
@@ -0,0 +1,67 @@
+{ config, lib, ... }:
+let
+ cfg = config.nx.media.mpv;
+ inherit (lib)
+ mkEnableOption
+ types
+ optional
+ mkIf
+ mkOption
+ ;
+in
+{
+ options.nx.media.mpv = {
+ enable = mkEnableOption "a free, open source, and cross-platform media player";
+ hdrExpansion = mkEnableOption "SDR to HDR inverse tone mapping";
+ targetPeak = mkOption {
+ description = "Peak brightness of the display";
+ type = types.int;
+ default = 500; # For MO27Q28G
+ };
+ };
+ config = mkIf cfg.enable {
+ programs.mpv = {
+ enable = true;
+ config = {
+ vo = "gpu-next";
+ gpu-api = "vulkan";
+ target-peak = cfg.targetPeak;
+ target-colorspace-hint = "yes";
+ };
+ profiles = {
+ # Dolby Vision profile
+ "DOVI" = {
+ profile-restore = "copy";
+ profile-cond = "p[\"video-dec-params/gamma\"] == \"auto\"";
+ target-trc = "pq";
+ target-prim = "bt.2020";
+ target-peak = cfg.targetPeak;
+ tone-mapping-mode = "auto";
+ };
+
+ # SDR look while in HDR
+ "SDR" = {
+ profile-restore = "copy";
+ target-trc = "pq";
+ target-prim = "bt.2020";
+ target-peak = 207;
+ tone-mapping = "bt.2390";
+ tone-mapping-mode = "rgb";
+ inverse-tone-mapping = "yes";
+ };
+
+ # SDR to HDR inverse tone mapping
+ "SDR_HDR_EFFECT" = {
+ profile-restore = "copy";
+ target-trc = "pq";
+ target-prim = "bt.2020";
+ target-peak = 406;
+ tone-mapping = "spline";
+ tone-mapping-mode = "rgb";
+ inverse-tone-mapping = "yes";
+ };
+ };
+ defaultProfiles = optional cfg.hdrExpansion "HDR_MODE:SDR_HDR_EFFECT";
+ };
+ };
+}