Jump to content

Auto Refresh Rate Switcher Tool for EmbyMC


shaneh20

Recommended Posts

shaneh20

Hey all, here's my little util I made for doing (slightly dodgy) automatic Refresh Rate switching for EMC's Inline Player in WMC.

I'm not sure if many people still use this setup, but I still do as it all works almost perfectly for me except that it doesn't have auto refresh rate switching which has always bugged me a bit. So, I hacked this thing together to help work around it. I'm no expert with this stuff, but it seems to work ok for me so I thought I'd share it for those interested. Not sure if something like this already exists, but if it does I couldn't find it.

It's an EXE that runs in your system tray and detects (using Embys Webhooks) when Emby MC starts/stops playing videos, upon which it switches your displays Refresh Rate to match the videos Frame Rate which helps reduce stuttering and make playback smoother. When playback stops, it switches the Refresh Rate back again. It has a customisable Rules system allowing you to choose what Refresh Rate to apply based on the Frame Rate of the Video that is playing.

To install it just run the MSI, which will put the exe in 'C:\Program Files (x86)\SMH\EmbyRefreshRateSwitcher'. It requires .NET Framework 4.8 to be installed already before you start it. Launch the exe and you'll get a stupid looking 'Hz' icon in your system tray, which brings up the settings when double-clicked. Hit F1 or click the Help button for more install details, which you must read & follow to configure it properly. Hover your mouse over the settings textboxes for extra help.

I've only tested it on my setup that has Win7 + Integrated Intel HD4000 GFX + EmbyMC (3.0.307.0) using the Internal Player + EmbyServer (4.5.4) + Sony HDTV (HDMI). If it fails on your setup, send me the logs in 'C:\ProgramData\SMH\SMH.EmbyRefreshRateSwitcher\Logs' and I'll try figure it out.

If it breaks anything, I'm not responsible ;)

 

Enjoy :D

 

 

 

 

 

SMH.EmbyRefreshRateSwitcher.Setup.msi

SMH.EmbyRefreshRateSwitcher.Code.zip

Edited by shaneh20
Link to comment
Share on other sites

shaneh20

I've noticed a slight quirk in the Emby Web Hooks, which is messing with my utilities ability to accurately detect when playback has resumed after pausing. When I pause a video in EMC, Emby Server strangely doesn't send me anything via the Webhook. I kinda expected it to send me a 'playback.paused' message or something. However, after about ~1 minute of pausing the video it eventually sends a 'playback.stopped', so my utility thinks playback has stopped even though it hasn't as its just paused still. When i resume playback in EMC, Emby Server doesn't send a 'playback.playing' message, so my utility thinks playback is stopped still even though it is resumed playing again.

Here are the Emby logs when it sends the 'playback.stopped' message after pausing for ~1 minute:

2021-02-03 21:28:21.806 Info SessionManager: Session 6c1ffc39d6dfa406bbeb9467fd338e33 has gone idle while playing
2021-02-03 21:28:21.806 Info SessionManager: Playback stopped reported by app MB-Classic 3.0.307.0 playing The Right Path. Stopped at 6939 ms
2021-02-03 21:28:21.807 Info HttpClient: POST http://localhost:19123/SMH/api/WebHook

I've also attached the JSON that Emby Server sends via the Webhook when this happens.

It looks like Emby is assuming playback has stopped since it hasn't heard anything from EMC for a while, which is fair enough. This would be ok, if only Emby Server would send a 'playback.playing' message again when it detects playback is resumed again, so my utility can set the Refresh Rate again. Would it be possible to make this change to Emby Server?

Paused After 20 Seconds Webhook Message.json

Link to comment
Share on other sites

I am also still using WMC with EMC but the way I solved the refresh is by using MPC-HC and than with madVR as the Video Renderer which does auto refresh as well as custom refresh rates if your display device supports it. I have used that combination for years when starting a video content everything opens in MPC-HC except Blu-Rays or DVDs they open up in PDVD. When MPC-HC runs just use the Ctrl-J combination and madVR will display all the Render details on the screen.

Link to comment
Share on other sites

shaneh20
3 hours ago, One2Go said:

I am also still using WMC with EMC but the way I solved the refresh is by using MPC-HC and than with madVR as the Video Renderer which does auto refresh as well as custom refresh rates if your display device supports it. I have used that combination for years when starting a video content everything opens in MPC-HC except Blu-Rays or DVDs they open up in PDVD. When MPC-HC runs just use the Ctrl-J combination and madVR will display all the Render details on the screen.

Yeah sounds good and for most people would be the way to go. I've tried fiddling with madVR and external players but for various reasons could never make them reliable on my setup and kept just giving up & going back to EMC's internal player which is solid for me (except for auto refresh rates). So, i thought i'd try this for fun. It's (surprisingly) almost working ok except for the above pausing issue with webhooks.

Link to comment
Share on other sites

shaneh20

For now i've added a bit of hack to help detect when playback has actually stopped, rather than just paused. Upon receiving a 'playback stopped' webhook message, my utility will validate it by double checking in the EMC logs (must be enabled) to determine if playback has ACTUALLY stopped. Although not ideal, this seems to work ok.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...