Using Plex HTPC on 21:9 aspect ratio screen

I have a PC hooked to a 21:9 screen.
Plex HTPC seems to run fine although the menu is in 19:9 aspect ratio.

With the normal plex desktop player or plex media player (without tweeaking), when playing a wide screen ( 2.39:1) film encoded in a 16:9 aspect ratio video file with horizontal black bars to fill (blu-ray often are), the video does not take the full screen and you have black bars on the left and right of the video, plus the one encoded in the file so you can’t enjoy the full size of your screen.
BUT with Plex HTPC, it seems the zoom feature is back and when playing a video, the video is played using the full resolution of your screen and you can zoom to hide all black bars using the zoom feature (“Z” key to cycle) in “Zoom” mode.

But it is not enough : if you have subtitle (image base one, like PGS for example), the zoom feature will not move the subtitle by default and they will be hidden because displayed in the horizontal black bars you are cropping with zoom mode.

Fortunately, the is a solution : in the mpv.conf (if non existent, create it in C:\Users\<your_user>\AppData\Local\Plex HTPC) you can add the following line :

stretch-image-subs-to-screen=yes

and that is it ! subtitle will move to the displayed 21:9 area when using the “zoom” mode !

3 Likes

Edit :
In fact the zoom mode set the panscan function that crop the video to fill the screen while retaining aspect ratio.
With a 2.35 aspect ratio film it will nearly do the trick on a 21:9 screen. But if you want a more precise control or you have a film with an other aspect ratio that is not near 21:9 here is the solution :

use a custom inputmap for the keyboard :
copy the file:
C:\Users\<your_user>\AppData\Local\Plex HTPC\inputmaps\defaults\keyboard.json
to
C:\Users\<your_user>\AppData\Local\Plex HTPC\inputmaps\keyboard.json

edit the json file and add after latest mappings :

	//zoom controls
	"Ctrl\\+\\+" : "mpv:add video-zoom 0.05",
	"Ctrl\\+\\-" : "mpv:add video-zoom -0.05",
	"Ctrl\\+\\*" : "mpv:cycle-values video-zoom 0 0.0574502 0.4025857 0.4269356",
	"Ctrl\\+0" : "mpv:set video-zoom 0",

after that

  • CTRL +/- will (un)zoom step by step
  • CTRL * will cycle predefined zoom level : 0 (reset) , 1.85:1 video, 2.35:1 video and 2.39:1 video
    note that these preset are calculated for 16:9 aspect video files with black bars to embed movies with other aspect ratio and displayed on a 21:9 screen
  • CTRL 0 will reset zoom
3 Likes

Hey there. Please can you post the full keyboard.json as I’m having trouble with the formatting. :man_facepalming:

Here is the full json file :

{
  "name": "Generic Keyboard",
  "idmatcher": "Keyboard.*",
  "mapping": {
    "Left": "left",
    "Right": "right",
    "Up": "up",
    "Down": "down",
    "Return|Enter": {
      "short": "enter",
      "long": "menu"
    },
    "Back|Esc|Backspace": {
      "short": "back",
      "long": "home"
    },

    // Standard text entry. There's no distinction between upper and lower case
    // letters. The optional Shift key is only a flexibility convenience.
    "(?:Shift\\+)?([A-Z0-9.])": "%1",

    // Use Shift+letter to jump to the associated letter in supporting lists.
    "Shift\\+([A-Z])": "jump+%1",

    // Application shortcuts.
    "Space": ["space", "play_pause"],
    "P": "play_pause",
    "Ctrl\\+P": "pause",
    "X": "stop",
    "B": "back",
    "H": "home",
    "M": "menu",
    "A": "cycle_audio",
    "L": "cycle_subtitles",
    "S": "toggle_subtitles",
    "Alt\\+A": "increase_audio_delay",
    "Alt\\+Shift\\+A": "decrease_audio_delay",
    "Alt\\+S": "increase_subtitles_delay",
    "Alt\\+Shift\\+S": "decrease_subtitles_delay",
    "PgUp": ["page_up", "seek_forward"],
    "PgDown": ["page_down", "seek_backward"],
    "Home": "step_backward",
    "End": "step_forward",
    "Ctrl\\+F": "search",
    "\\[": "previous_pivot_tab",
    "\\]": "next_pivot_tab",
    "=": "increase_volume",
    "(Shift\\+)?\\+": "increase_volume",
    "\\-": "decrease_volume",
    "I": "info",
    "W": "toggle_watched",
    "Z": "cycle_aspect_ratio",
    "Ctrl\\+Shift\\+D": "debug",

    // Application window handling.
    "Alt\\+(Return|Enter)": "toggle_fullscreen",
    "F11": "toggle_fullscreen",
    "\\\\": "toggle_fullscreen",
    "E": "exit",

    // The `|<< <<` and `>> >>|` button on a Harmony Hub remote sends different
    // keys based on the Harmony device configuration. A long press action to
    // send `skip_previous` or `skip_next` must be configured in the Harmony
    // app. The default configuration sends no keyboard events to Plex.
    //
    // - "Media Rewind" and "Media Fast Forward" are sent when the device is
    //   configured as a Windows computer.
    // - "R" and "F" are sent when the device is configured as a Microsoft Plex
    //   entertainment device..
    "(Media Fast Forward)|F": "seek_forward",
    "(Media Rewind)|R": "seek_backward",

    // These keys appear to be sent by MCE remotes.
    "(Media Play)":"play",
    "(Media Pause)":"pause",
	
	//zoom controls
	"Ctrl\\+\\+" : "mpv:add video-zoom 0.05;show-text \"ZOOM ${video-zoom}\"",
	"Ctrl\\+\\-" : "mpv:add video-zoom -0.05;show-text \"ZOOM ${video-zoom}\"",
	"Ctrl\\+\\*" : "mpv:cycle-values video-zoom 0 0.0574502 0.4025857 0.4269356;show-text \"ZOOM ${video-zoom}\"",
	"Ctrl\\+0" : "mpv:set video-zoom 0;show-text \"ZOOM ${video-zoom}\"",
	
  }
}
1 Like

Interesting. I can’t get Plex HTPC to respond to those commands. Nothing happens when I press the controls.

EDIT: I’m just a moron and didn’t copy the file to the correct place.

Have noticed it will retain the same zoom level after closing and opening a new file. Would be good if it could reset to 0.

HTPC only resets values in MPV that it sets. However the mpv.conf file is re-read before each playback so you can likely set the properties to the default values you want in this file to accomplish what you want.

This is my current mpv.conf but it still doesn’t reset the video-zoom.

vo=gpu
hwdec=nvdec 
gpu-api=d3d11
gpu-context=d3d11
blend-subtitles=no
keepaspect=yes
monitoraspect=2.38 
cache=yes
stream-buffer-size=61.0352MiB
demuxer-max-bytes=500000000
stretch-image-subs-to-screen=yes
tls-ca-file=C:\Program Files\Plex\Plex HTPC\resources\cacert.pem
mpv:set video-zoom 0

[HDR]
profile-cond=p["video-params/primaries"] == "bt.2020"
d3d11-output-csp=pq
d3d11-output-format=rgb10_a2
target-trc=pq
target-prim=bt.2020
hdr-compute-peak=no
target-peak=1000 
dolbyvision=no

[SDR]
d3d11-output-csp=srgb

I think in MPV.conf the syntax is not the same. Try :

video-zoom=0

That worked! Thanks so much.

Stupid Q:
Did you compute these zoom factors or did you just try them out?
I’m looking for good values for a 32:9 monitor.

1 Like

I compute them for a 21:9 screen:
Given a video file with 16:9 factor displayed full screen and preserving aspect ratio
If the usefull part of the video is 2.35:1 (often in Blu-ray’s files, the movie is 2.35:1 but encoded with black bars to fit in a 16:9 video file), you have to zoom the video of 9*2,35/16= 1,321875 if you want it to occupy the whole height (no horizontal black bars) of the screen . A 2.35:1 movie fit in height in a 21:9 screen but it will work also with a 32:9 screen as it is larger.
But the zoom factor is expressed in binary logarithm in MPV
So the zoom factor is ln(1,321875)/ln(2)=0,4025857….

2 Likes

11 posts were split to a new topic: No full video on 4K TV

A post was merged into an existing topic: No full video on 4K TV