Skip to content

Instantly share code, notes, and snippets.

@azumukupoe
Last active August 5, 2025 01:48
Show Gist options
  • Save azumukupoe/a56a78d71cf26a8f682dc06407e615db to your computer and use it in GitHub Desktop.
Save azumukupoe/a56a78d71cf26a8f682dc06407e615db to your computer and use it in GitHub Desktop.
AutoVSR for MPV

AutoVSR for MPV

This Lua script automatically enables NVIDIA Video Super Resolution (VSR) in MPV

Features:

  • Dynamically adjusts scaling based on display and video resolution
  • Toggle with Ctrl+Shift+U (default: off)

Usage:

  1. Place autovsr.lua in your MPV scripts folder
  2. Restart MPV
  3. Press Ctrl+Shift+U to toggle VSR

🔗 Original discussion comment: mpv-player/mpv#14804

local mp = require 'mp'
local autovsr_enabled = false
local function autovsr()
local display_width = mp.get_property_native("display-width")
local video_width = mp.get_property_native("width")
local display_height = mp.get_property_native("display-height")
local video_height = mp.get_property_native("height")
if video_width and display_width and video_height and display_height then
local scale = math.max(display_width, display_height) / math.max(video_width, video_height)
scale = scale - scale % 0.1 --
local vf = mp.get_property("vf") or ""
if string.match(vf, "@vsr") then
mp.command("vf remove @vsr")
end
if scale > 1 then
mp.command("vf append @vsr:d3d11vpp:scaling-mode=nvidia:scale=" .. scale)
end
end
end
local function activate()
autovsr_enabled = not autovsr_enabled
if autovsr_enabled then
autovsr()
mp.observe_property("video-params/pixelformat", "native", autovsr)
mp.observe_property("vf", "native", autovsr)
mp.osd_message("RTX ON")
else
mp.command("vf remove @vsr")
mp.unobserve_property(autovsr)
mp.osd_message("RTX OFF")
end
end
mp.add_key_binding("ctrl+shift+u", "autovsr", activate)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy