jellyfin-mpv-shim
jellyfin-mpv-shim copied to clipboard
Change refresh rates based on video framerate
Is your feature request related to a problem? Please describe. When a video uses a different framerate to that of the screen, and specially if the screen framerate is not a multiple of the video framerate, the image can have noticeable lack of smoothness.
Describe the solution you'd like Have the client change the refresh rate of the screen (if supported) to a multiple of that of the video. For example, if the video plays at 25fps, change the refresh rate to 25, 50 or 75 Hz, whichever is the highest supported. TVs usually allow for common NTSC or PAL framerates (23.97, 29.97, 59.94, etc.).
Describe alternatives you've considered
I've tried using Lutz Vieweg's mpv-plugin-xrandr by configuring mpv-shim to use an external player with that script loaded, but since mpv-shim starts an instance of mpv with the --idle=yes
flag, the script only works for the first playback, and it does not return to the former framerate once the player quits (because it doesn't shutdown mpv).
I was able to add an event handler on the script to return to the former framerate when playback stopped, but I was not able to make it change refresh rates again on subsequent videos.
Please see: https://gist.github.com/iwalton3/764b95871a52cbb23c4959a4da76e3d6
Thank you! I understand I have to add modes to xrandr fitting framerates supported by my screen, and then modify the script to call those modes?
In essence yes. Some modes are not declared as supported but you can add them if you set some overrides in xorg.conf.
Describe alternatives you've considered I've tried using Lutz Vieweg's mpv-plugin-xrandr by configuring mpv-shim to use an external player with that script loaded, but since mpv-shim starts an instance of mpv with the
--idle=yes
flag, the script only works for the first playback, and it does not return to the former framerate once the player quits (because it doesn't shutdown mpv).I was able to add an event handler on the script to return to the former framerate when playback stopped, but I was not able to make it change refresh rates again on subsequent videos.
Not sure if we are using the same script but I added this to make mine work:
function on_start_file()
xrandr_previously_set = {}
xrandr_cfps = nil
xrandr_set_rate()
end
mp.register_event("file-loaded", on_start_file)
mp.register_event("end-file", xrandr_set_old_rate)
Any chance of building a feature like this into jellyfin-mpv-shim?
It isn’t planned because it requires different code on each platform and the xrandr script works well enough for me.
Jellyfin Media Player does have this feature, but of course there are many limitations for customization in that player.
I see. Thanks. I'll look into getting the script working.
I can't use Jellyfin Media Player since there's no build for Raspi.