Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't seem to make an external MPV player honor its own mpv.conf and input.conf #341

Open
movieperson opened this issue Jun 13, 2023 · 4 comments

Comments

@movieperson
Copy link

movieperson commented Jun 13, 2023

I am attempting to use a heavily customized version of MPV and have it only use its own configuration file as it does when it is directly invoked from the command line. (start /min D:\apps\mpv_default\mpv.exe).

From my conf.json

"mpv_ext": true,
"mpv_ext_ipc": "MyIPCPath" , (Note: I tried leaving this blank as well)  When using this parameter, I tried starting mpv with
                                                                                  start /min D:\apps\mpv_default\mpv.exe --input-ipc-server=MyIPCPath          
"mpv_ext_no_ovr": true,  (Note I tried both true and false for this parameter)
"mpv_ext_path": "D:\\Apps\\mpv_default\\mpv.exe",
"mpv_ext_start": false,  (Note I tried both true and false for this parameter)
"mpv_log_level": "info",

The default jellyfin-mpv-shim menu screen still appears, rather than using my input.config.

Is it me, or is another issue preventing this from working? Or is it working as designed?

my modified MPV config files are attached.

I have also tried placing the conf files in the C:\Users\MyName\AppData\Roaming\jellyfin-mpv-shim directory with no results.

Thanks in advance for any help as I wasn't exactly sure how to classify it.

input.conf.txt
mpv.conf.txt

@dmgolembiowski
Copy link

dmgolembiowski commented Jul 17, 2023

@movieperson are you comfortable tweaking some Python on your local machine? I don't have a Windows environment to test this on, but I think the breakdown is occuring at a few key locations, however I've included a sanity check below which should be done before inspecting the bug.

Sanity Check

@movieperson If I correctly understand how your desired setup is supposed to work, let me verify a couple of assumptions. Assuming you are running jellyfin-mpv-shim.exe from CMD, it will have a %PATH% variable. Try running echo %PATH% for a priority-ordered list of folders that hold your binaries. You want to check for a few things. First, please check if there is more than one installation of either jellyfin-mpv-shim.exe or mpv.exe, and verify that their versions correspond to the build you want. If both of these are not present on %PATH%, you might want to extend your environment variable in your system settings. It's worth noting that you need to open a new CMD terminal to have these take effect, or simply log out and log back in to have the fresh values loaded into the environment.

The next thing to consider is that "mpv_ext_ipc" corresponds to the executable file's absolute path. For your specific case, the key-value pair in conf.json should be:

"mpv_ext": true,
"mpv_ext_ipc": "D:\\apps\\mpv_default\\mpv.exe",

If your computer runs multiple different versions of Python, check that %PATH% variable and verify it's the one corresponding to the build version you need.

Possible source of bug

This last bit is probably where one of your problems is occurring, and it's a subtle thing specific to the MPV player this attempt tries to construct. On Windows, the system call to remove the IPC socket fails because it is still being held by an external process (your start /min ... command). Because of this, the process terminates the IPC socket that would have been created by the jellyfin-mpv-shim (for @iwalton3 see python_mpv_jsonipc).

# python_mpv_jsonipc.py
log.debug("Staring MPV from {0}.".format(mpv_location))
ipc_socket_name = ipc_socket
if os.name == 'nt':
    ipc_socket = "\\\\.\\pipe\\" + ipc_socket

    if os.name != 'nt' and os.path.exists(ipc_socket):
        os.remove(ipc_socket)

    log.debug("Using IPC socket {0} for MPV.".format(ipc_socket))
    self.ipc_socket = ipc_socket

For @movieperson this could mean you do not want to have an existing MPV process running elsewhere to use an IPC socket. (Maybe there's a way to reload a new config after the process gets spawned?) The child MPV process (seems like it) needs to be spawned by this application, otherwise it will fall back on trying to spin up an instance that works.
This seems to directly contradict the third bullet point of README.md on Windows.

@movieperson
Copy link
Author

Note that I am running mpv in portable_config mode, so all the config files are in that subdirectory.

What's not clear to me is whether there should even be an mpv.conf and an input.conf file in the portable_config directory or if the files with that name in the roaming\jellyfin directory take their place or override them.

I did create a batch file and added the paths.
set PATH=%PATH%;D:\apps\mpv_default;C:\Program Files (x86)
"C:\Program Files (x86)\Jellyfin MPV Shim\run.exe"

@movieperson
Copy link
Author

Making some progress, although looking in task manager I notice I have a bunch of run.exe and runbroker tasks left over when I end MPV.

I think the issue I am having is mostly conflicts between my key defs and the defaults. Stuff that works in native MPV doesn't do the same function, or more likely just hangs. I have deleted the mpv.conf and input.conf from the MPV portable config directory.

It would help if you could publish base working input.conf and mpv.conf files. for example, I have not been able to bring up the jellyfin menu with the "c" key, although I vaguely remember that working when I first installed Jellyfin_shim. Simply copying my MPV conf files just doesn't work, even though they work perfectly in native MPV.

Thanks

@soredake
Copy link

soredake commented Mar 12, 2024

Same problem.

No such problem with https://github.com/iwalton3/plex-mpv-shim for plex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants