Video Zoom (Crop) in Plex Desktop app

Server Version#: 1.27.2.5929
Player Version#: 1.50.1.3176-06a9352d

I’m an ultrawide user, I often have to zoom in to crop out hardcoded black bars, etc. I thought to myself “oh neat, plex has inputmaps, let me just bind some key combo to adding zoom”, but unfortunately they are completely non functional on plex for windows. They work on HTPC, but the exact same keyboard.json file i have for HTPC does absolutely nothing on Plex for Windows

Any fix for this? It’s incredibly annoying to go into the mpv.conf every time and change the setting myself with a text editor…

2 Likes

Plex for Windows does not map the keyboard to commands. The UI is architected differently and so keyboard mapping to commands would not be appropriate for it.

No way to override it? What about sending actions to MPV? Because all I really want is that, to send pan-scan add to mpv

You likely want to use a lua script to accomplish this. Additionally key bindings from scripts are honored in both apps.

1 Like

I didn’t know that! Any guide on how to use the lua scripts? Like where to put them, what to write in them apart from the fact that they’re in lua, etc

It would also be nice to include the info about having no mapping for keyboards in an .md file in the keymaps directory, because it’s fairly confusing. If you could pass that on to the team that’s working on those apps, I’d really appreciate it since It took me about 3 weeks of messing around to no avail to come to this forum haha

Figured it out. For anyone having the same issue as me, check this example script out. Keybinds only work through the mp.add_forced_key_binding() function, non-forced does nothing.

The keybinds are Shift++, Shift+- and Shift+0 to add, subtract and reset the zoom level respectively.
Don’t forget to change the extension to .lua, and then you can just put it in %LOCALAPPDATA%\Plex\scripts\ for it to work.

zoom-keybinds.txt (798 Bytes)

[admin edit: file attachments are automatically purged after a few months, so it is better to embed short scripts directly]

function round(num, numDecimalPlaces)
    local mult = 10^(numDecimalPlaces or 0)
    return math.floor(num * mult + 0.5) / mult
end

function zoomAdd()
    mp.command("add video-zoom +0.05")
    zoom_level = mp.get_property("video-zoom")
    zoom_level = round(zoom_level, 2)
    mp.osd_message("Zoom: "..zoom_level, 0.5)
end

function zoomSub()
    mp.command("add video-zoom -0.05")
    zoom_level = mp.get_property("video-zoom")
    zoom_level = round(zoom_level, 2)
    mp.osd_message("Zoom: "..zoom_level, 0.5)
end

function zoomReset()
    mp.command("set video-zoom 0")
    mp.osd_message("Zoom reset")
end

mp.add_forced_key_binding("+", "zoomAdd", zoomAdd)
mp.add_forced_key_binding("_", "zoomSub", zoomSub)
mp.add_forced_key_binding(")", "zoomReset", zoomReset)
24 Likes

Where are these scripts located on Linux or Mac?

On Linux it depends on how you installed it.

For flatpak installations: ~/.var/app/tv.plex.PlexDesktop/data/plex/
For snap installations: ~/snap/plex-desktop/common/
(snap plex crashed for me, but i’m about 90% sure it’s there)
For the AUR plex-desktop package: /opt/plex-desktop/resources/
(same as snap for me - couldn’t test)

On macOS it’s in ~/Library/Application\ Support/Plex/

All of those had the scripts directory missing, but after creating it, it worked on both Mac and Linux (well, the Plex installs that didn’t crash).

2 Likes

Ok, I tried this on my Mac and Linux machine - neither worked. I followed these steps.

  1. Copied the script zoom-keybinds.txt to these locations:
  • Mac PMP: /Users/userid/Library/Application Support/Plex Media Player/scripts (I had to create the scripts directory)
  • Mac HTPC: /Users/userid/Library/Application Support/Plex HTPC/scripts
  • Linux: ~/snap/plex-htpc/common/scripts
  1. I renamed the file extension to .lua
  2. I restarted PLEX HTPC on both devices
  3. I tried the keyboard combinations Shift + + and Shift + - and neither worked :cry:

What am I doing wrong, is there something else I need to add? Do I have to be on a certain screen? I’m using an attached keyboard, but if I can get this working I could map it to keys on my remote - it would be glorious. What am I missing? Thanks for your help!

I tested this on Plex Desktop not HTPC or PMP for Linux, macOS and Windows and it worked fine.
For a remote, I think you have to use inputmaps on HTPC as those actually work. For any connected keyboard this should work, though

For Plex HTPC, please refer to Using Plex HTPC on 21:9 aspect ratio screen - #2 by o_spring

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.