mpv: downmix surround sound to stereo using a HRTF-aware filter (sofa)
This commit is contained in:
@@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.sane.programs.mpv;
|
cfg = config.sane.programs.mpv;
|
||||||
|
myHrtf = "${pkgs.sofacoustics.listen.irc_1052}/share/sofa/listen-irc_1052.sofa";
|
||||||
uosc = pkgs.mpvScripts.uosc.overrideAttrs (upstream: {
|
uosc = pkgs.mpvScripts.uosc.overrideAttrs (upstream: {
|
||||||
version = "5.2.0-unstable-2024-03-13";
|
version = "5.2.0-unstable-2024-03-13";
|
||||||
src = lib.warnIf (lib.versionOlder "5.2.0" upstream.version) "uosc outdated; remove patch?" pkgs.fetchFromGitHub {
|
src = lib.warnIf (lib.versionOlder "5.2.0" upstream.version) "uosc outdated; remove patch?" pkgs.fetchFromGitHub {
|
||||||
@@ -144,6 +145,8 @@ in
|
|||||||
# i use enable52Compat in order to get `table.unpack`.
|
# i use enable52Compat in order to get `table.unpack`.
|
||||||
# i think using `luajit` here instead of `lua` is optional, just i get better perf with it :)
|
# i think using `luajit` here instead of `lua` is optional, just i get better perf with it :)
|
||||||
lua = pkgs.luajit.override { enable52Compat = true; self = lua; };
|
lua = pkgs.luajit.override { enable52Compat = true; self = lua; };
|
||||||
|
# ship a ffmpeg with sofa enabled, for surround-sound downmixing
|
||||||
|
ffmpeg = pkgs.ffmpeg-full;
|
||||||
};
|
};
|
||||||
scripts = [
|
scripts = [
|
||||||
pkgs.mpvScripts.mpris
|
pkgs.mpvScripts.mpris
|
||||||
@@ -221,6 +224,7 @@ in
|
|||||||
fs.".config/mpv/scripts/sane_cast/main.lua".symlink.target = ./sane_cast/main.lua;
|
fs.".config/mpv/scripts/sane_cast/main.lua".symlink.target = ./sane_cast/main.lua;
|
||||||
fs.".config/mpv/scripts/sane_sysvol/main.lua".symlink.target = ./sane_sysvol/main.lua;
|
fs.".config/mpv/scripts/sane_sysvol/main.lua".symlink.target = ./sane_sysvol/main.lua;
|
||||||
fs.".config/mpv/scripts/sane_sysvol/non_blocking_popen.lua".symlink.target = ./sane_sysvol/non_blocking_popen.lua;
|
fs.".config/mpv/scripts/sane_sysvol/non_blocking_popen.lua".symlink.target = ./sane_sysvol/non_blocking_popen.lua;
|
||||||
|
fs.".config/mpv/hrtf.sofa".symlink.target = myHrtf;
|
||||||
fs.".config/mpv/input.conf".symlink.target = ./input.conf;
|
fs.".config/mpv/input.conf".symlink.target = ./input.conf;
|
||||||
fs.".config/mpv/mpv.conf".symlink.target = ./mpv.conf;
|
fs.".config/mpv/mpv.conf".symlink.target = ./mpv.conf;
|
||||||
fs.".config/mpv/script-opts/osc.conf".symlink.target = ./osc.conf;
|
fs.".config/mpv/script-opts/osc.conf".symlink.target = ./osc.conf;
|
||||||
|
@@ -26,3 +26,10 @@ border=no
|
|||||||
# # with `ao-volume`, the max actually is 100.
|
# # with `ao-volume`, the max actually is 100.
|
||||||
# # to go higher you'll have to use the system's native controls.
|
# # to go higher you'll have to use the system's native controls.
|
||||||
# volume-max=100
|
# volume-max=100
|
||||||
|
|
||||||
|
# libmysofa Head Related Transfer Function file to use to downmix surround -> stereo
|
||||||
|
# for specifically my skull
|
||||||
|
# see: <https://ffmpeg.org/ffmpeg-filters.html#sofalizer>
|
||||||
|
# TODO: this maybe belongs in pipewire instead of mpv.
|
||||||
|
# at least, provide a way to disable the downmixing, so i can still output 5.1 over HDMI?
|
||||||
|
af=sofalizer=sofa=/home/colin/.config/mpv/hrtf.sofa
|
||||||
|
Reference in New Issue
Block a user