Log in

View Full Version : A cool method to launch your video player with different settings


poisonborz
20th February 2021, 14:39
I often needed my video player to launch with some custom settings for some different video files (eg. I don't want madvr to be set in MPC for a very high bitrate 8k60fps video). I know that there are profile groups (in madvr) or automatic settings based on resolution (in some players) etc but setting those up is more tedious. Therefore I present a way to just exchange some settings on the fly, so you can have a shortcut to "LAV-lessVideoPlayer" or "FastVideoPlayer" etc. Solution is Windows only.

What is needed:
- A video player that has config stored in files (portable versions are best)
- AutoHotKey
- Hugo AHK String library - copy-paste this and save it as "tf.ahk" in the same folder as you have the video player config file: https://raw.githubusercontent.com/hi5/TF/master/tf.ahk

I'm using the above example, but you can apply this to any player/setting.
Obvious TSA: be aware that this might bork your config. Make backups, mind what you do.

MPC-BE stores its settings in mpc-be64.ini. Make a copy of this file. Now make your changes, so for our case change the video renderer from madvr tp EVR-CP. Save and exit. Now look at the difference between the two .ini files (you can use WinMerge for this). As we see the change is a simple VideoRenderer=7 to VideoRenderer=3 (your numbers can vary).

We will create two scripts that launch with either this or that setting. The scripts will change the .ini file permanently so we need two shortcuts - to either launch with madvr or EVR-CP.

Make two new .ahk files (eg. mpc_madvr.ahk and mpc_evrcp.ahk) with the following contents - this does a "search and replace" in the file, changing the values. You can have more TF_Replace lines if you want to modify more things.

#Include tf.ahk
TF_Replace("!mpc-be64.ini","VideoRenderer=7","VideoRenderer=3")
Run "mpc-be64.exe" %1%, %2%

In the other file, simply exchange the VideoRenderer numbers. You can customize the file paths (eg. c:\myapps\mpc-be\mpc-be64.exe) if the script is somewhere else. Don't forget that these changes are permanent, so you probably need to "undo" them in another script (your "normal" config). the % numbers ensure that command line arguments are passed to your player. You might want to associate video files with your "normal" player config .exe to ensure that you launch with those settings.

Now find Ahk2Exe.exe in the Autohotkey folder and run it, drag both of your scripts in there one by one and hit "Convert" - this creates the .exe files.

Now verify that launching the two files, your settings are applied.

butterw2
20th February 2021, 16:48
Using a .bat to rename mpc.ini filenames before launch has been suggested before as a means to switch between two mpc config files in a single install.

With Mpv you can specify the following:
--config-dir
--use-filedir-conf (which will load mpv.conf from the same directory as the file you're playing.)
custom file extension profiles are also not difficult to setup in mpv.

poisonborz
20th February 2021, 17:29
Yes that kinda works as well, but it's also inferior, since whenever you change some other settings (whatever you don't want to switch) you need to remember to copy it between configs. The one above is a "set and forget" method, truly only switching the settings that need to be.

Asmodian
21st February 2021, 06:44
I often needed my video player to launch with some custom settings for some different video files (eg. I don't want madvr to be set in MPC for a very high bitrate 8k60fps video). I know that there are profile groups (in madvr) or automatic settings based on resolution (in some players) etc but setting those up is more tedious.

LOL!

I like how setting up automatic search and replace scripts with Hugo AHK seems easier to you than figuring out profiles in madVR. :D

Are you a software engineer? I notice they often think some crazy command line or code solution is easier than figuring out someone else's GUI.

This is a cool solution... but I think for most people madVR profiles are a tad easier, they are fully automatic and have less dependencies too. ;)

poisonborz
21st February 2021, 22:40
Well yes, I am :D But I think my reasoning here was that setting up intricate "if-then" profiles will create what is called "magic" -> things that work in the background, and are forgotten, and when something doesn't work as expected, only after some cursing do you realise it was because of this setup. So I thought it's more obvious to have a "setting x" and "setting y" player. But nevertheless, it was just an example, and this can also be used for more complex scenarios.