Thanks for this. The main thing I’m struggling with is the “workflow” – Plex HTPC will update itself at launch if it has previously detected and downloaded an update – I haven’t seen a way to disable that – and once it does, playback won’t work for me until I update mpv-1.dll again (since I am using gpu-next). Long term my ambition is to make my Plex HTPC setup as “appliance-like” as possible where I don’t always have a keyboard/mouse at hand, and updates happen without user intervention (post-install isn’t the only challenge here, as the Plex HTPC installer always prompts for UAC admin access even when it doesn’t need it).
You can disable auto-update with
[debug]
disableUpdater=true
added to the plex.ini.
So with this piece of the puzzle, I decided to try something dumb - I created a powershell script that does automatic, completely unattended updates to PlexHTPC on Windows and also updates the mpv library to the latest unofficial version.
This was my first time trying to write a powershell script and I’m certain my code is … inelegant … to say the least, but the process was fun and I learned a ton so I figured I’d share the effort here:
Now I don’t suggest anyone else actually try and use this (and if you do, you do so completely at your own risk!) – I built this for me and my setup really just as an experiment, but maybe someone else with find something interesting in there.
It is designed to be run nightly by Windows Task Scheduler. Here is what it does:
- It will look up the latest Plex HTPC windows release from the plex.tv website and compare it to what is currently installed. I couldn’t figure out a way to programmatically determine the version number of the currently installed version, so instead I just added a file to the Plex HTPC config folder with the “last known” version that was installed.
- If the version on plex.tv is newer, it will download it (and validate the hash of the download) and extract the files from the installer exe.
- Next, it will scrape shinchiro’s libmpv sourceforge page and download the latest x86_64 package (my regex skills were not strong enough to extract the correct SHA1 value from the webpage, so I don’t validate the hash of this download).
- If Plex HTPC is currently running, it will shut it down, then copy over the files from the installer and then copy the updated mpv-2.dll. Note: in order to be unattended and not worry about UAC prompts, I made sure my original Plex HTPC install was in an unprotected directory (ie,
C:\Plex HTPC\). [EDIT: This may not be necessary if using the "Run with highest privileges setting in Task Scheduler. Need to test this.] - After it’s done copying the new files into place, it will restart Plex HTPC if it was running before and clean up the temp files, and then finally updates the “last known” version file with the new version number.
For it to work, I’ve made a bunch of (probably bad) assumptions, and it has many known limitations right now as well:
- Plex HTPC must already be installed on the PC – this does not replicate the original installers full setup (doesn’t create a config folder, make shortcuts, modify registry, etc).
- The original install of Plex HTPC needs to be in an unprotected directory (ie, not “Program Files”) and must be manually specified in the script.
- This only works on Windows (obviously).
- While this approach of “just copy the new files over the old ones” seems to work, it likely is not giving the installer update process enough credit and could very well break things now or in the future.
- It’s a dumb idea to grab the latest daily build of libmpv as it could be broken/incompatible but it is fun to live on the edge

- You need to disable in-app auto updates (which are automatic, but not unattended, and will undo libmpv changes) using the disableUpdater setting quoted above.
- The script relies on 7zip or variant (I use NanaZip from the Windows Store) to extract the files from the installer executable and the libmpv archive.
- I’ve only minimally tested this in the scope of my Windows 11 PC, running PowerShell v7. I have no idea what minimum version of Windows or PowerShell it will actually work with.
- The script doesn’t yet have any good error handling, or data validation, so it almost certainly will fail in spectacular ways in the future.
Anyhow, I think this could solve my last need for an appliance-like Plex HTPC experience, we’ll see how it holds up over the next few weeks of updates. I had a lot of fun building this, hopefully someone else will find nuggets of usefulness in there as well.
Maybe I’m blind, but I can’t figure out where to put mpv.conf. Also, when I copy the new mpv file into the folder and rename the old one it breaks video playback in PlexHTPC.
As written in the first post - the mpv.conf should be put in your C:\Users\xxx\AppData\Local\Plex HTPC dir.
This is due to the missing mpv.conf that should contain the tls-ca-file=C:\Program Files\Plex\Plex HTPC\resources\cacert.pem line.
Do note that starting with HTPC 1.20.2, the mpv library is now mpv-2.dll and is not mpv-1.dll.
Ah, so I did it right! I guess I was expecting there to be an existing mpv.conf file for me to replace. So my other settings (the ones set in the program itself) will be fine as-is, and the conf file only needs to have the HDR passthrough settings, correct? I’ll add the CA cert line and try again.
Thank you!
So when I replace it, I should rename the new file mpv-2.dll as well?
Yes, although mpv-2.dll is the default name of that library, both in the mpv app package, and in shinchiro daily builds, so you shouldn’t have to rename, just replace.
#first post updated with the new mpv-2.dll naming.
Why is the vulkan route stating to turn off HDR switching? With it on it seems to workaround the issue where HDR output to the display is not turned off by the drivers. When it is on, then HTPC will switch into HDR, then vulkan will pass its own metadata, and then when playback ceases HTPC will switch out of HDR.
That’s a good question. While testing I was under the impression that having both options enabled the HDR result was mangled due to Windows HDR being enabled and the Vulkan layer not working on top of it. (but yes this would definitely “fix” the vulkan mpv hdr issue) To be fair I have not tested this scenario since then, maybe I messed it up. If the results are fine in your testing I can edit my first post again.
I’ve only tested on a machine with an Intel GPU and every time I use target-colorspace-hint=yes on it (whether it is currently in HDR or not), the video is 50% green lines. So I cannot say whether it is working correctly or not but it seems to behave the same whether I have HTPC’s HDR switching enabled or not.
Sounds like you may have a file with both Dolby Vision and HDR10/10+.
If this is the case, you can set dolbyvision=no in the mpv.conf and it should then display the HDR10 correctly.
No, it’s straight HDR10. It only has issues if target-colorspace-hint=yes is set so I expect it’s just a straight Intel driver bug.
I have tried it now with both options enabled. The HDR result seems fine but after the file ends the TV is still not switched back to SDR.
One thing I noticed too about the square with just “Vulkan” I mentioned here, after a mode change it is still visible. ![]()
With the recent Plex htcp release supporting vo=gpu-next, do we still need to use another mpv2.dll?
Do we still perform the same edits to the mpv.conf as suggested in the original post?
Thank you!
It depends on exactly what you want. We had to remove dovi processing code from the version we ship. Additionally you will want the other version of mpv-2.dll if you want to play with the cutting edge (we rebase our MPV only when we have reason to do so).
FWIW, in my experience if you replace the mpv-2.dll with the other version and use vo=gpu-next/target-colorspace-hint=yes, then PlexHTPC will correctly tonemap DolbyVision Profile 5 content, but it won’t trigger DolbyVision mode on the display and do full metadata passthrough (instead the tonemapped imaged is displayed in SDR). HDR10 content will trigger HDR on the display and passthrough the metadata.
As far as I can tell, this is true of the mpv standalone app as well - but I could be missing something, as I rarely use MPV standalone.
Even without the DV passthrough, its nice to have the colors and tonemap right.
FWIW, this appears to occur in D3D11 as well but not as noticeable. When I was playing the 3rd Harry Potter Movie (Prisoner of Azkaban), the scene where Harry is conjuring a Patronus, most of the display is a very bright white. There is a slightly less white square where the cursor is located.
I have played a few things in HDR using the metadata passthrough in D3D11 as described in this thread and this was the first instance where I noticed this. So it appears to be there as well but not as dramatic.