mpvnet-player / mpv.net

🎞 mpv.net is a media player for Windows with a modern GUI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mpvnet.exe sometimes failed when playing a file in a directory with lots of files over network share

char101 opened this issue · comments

Describe the bug
When trying to open a mkv file containing (note that is a unicode character 0xFF5C and not |) in the file name that is located in a smb (samba) share, mpvnet.exe failed with this error

System.Exception: mpv_create_client error
   at MpvNet.MainPlayer.Init(IntPtr formHandle, Boolean processCommandLineArguments)
   at MpvNet.Windows.WinForms.MainForm.Init()
   at MpvNet.Windows.WinForms.MainForm..ctor()

I tried opening it with mpv.exe and mpv.exe can plays it.

mpvnet.exe can open the file if the file is copied first to a local drive.
mpvnet.exe can open the file is it is opened using drag and drop from the remote drive.

To Reproduce
Create a file containing in a shared drive, then open it using mkvnet.exe.

Expected behavior
File can be played.

Additional context
Add any other context about the problem here.

  1. mpv.net version 7.0.0.6
  2. Windows version 10

It's difficult for me to reproduce, maybe it's just the path incorrectly handled, so what is the full path?

Sorry my analysis of the problem was wrong. It is not because of the unicode character. Sometimes mpvnet.exe can actually play the file. And if I run procmon, when it failed, it didn't even open access to the file, only to the directory where the file is located.

Another info, this directory contains around 1500 files which is a bit slow when enumerated over the network. If I copy the file into an empty directory, it can be played consistently. This looks to be a problem when enumerating the directory contents.

mpvnet is configured with process-instance=multi, keep-open=no, and idle=no, so I think there is no need to enumerate the directory contents in this case.

In the conf editor, you can find an option auto-load-folder, it should be possible to disable this feature and use an alternative, which you can find here:

https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/autoload.lua

This script, like most scripts, should work in mpv.net. Maybe it works with your network folder, or can be modified to make it work, you can request support for the script on the mpv tracker, maybe it's a known problem or a developer helps with it, I know Lua, maybe the script can be changed to skip loading certain folders, based on a blacklist.

I just checked it and auto-load-folder is already set to no.

I can play the files consistently with mpvnet.com but playing the file from the terminal has another problem that if the file name has a unicode character that is not supported by the terminal font, mpvnet.com will fail with file not found error.

auto-load-folder is the only feature in mpv.net that enumerates files in a folder.

mpvnet.com is identical to mpv.com, the only difference is the file being renamed.

What terminal do you use? What would be an example filename?

I don't know how else I can help.

Looking at the code, the only way for mpv_create_client to returns 0 is when it failed to find a client name, which seems to have nothing to do with the media path.

I tried with a lot of file names and there is no pattern to it, sometimes it failed and sometimes it played successfully.

I will close this issue since the problem doesn't seem to be from mpv.net.

Thanks for your help.

If possible, please post a file path, just change some parts of the path if you have security concerns. It's really the only chance for me to investigate it.

It is not about the file path. I have tried renaming and moving the files. The only consistent factor is that only the files in that directory containing ~1500 files sometimes triggered above exception.

And the error message is always identical?

'mpv_create_client error' ?

When this code runs, files were not yet passed to libmpv, files are loaded later!

Yes the error is always mpv_create_client error.

It started from

https://github.com/mpvnet-player/mpv.net/blob/main/src/MpvNet/Player.cs#L143

mpv_create_error only returns NULL here

https://github.com/mpv-player/mpv/blob/ab5b25034331ea7740b12e5314e16b1d5ad7624b/player/client.c#L282

libmpv-2.dll seems to be compiled with -O3, sometimes this could cause wrong optimization

https://github.com/shinchiro/mpv-winbuild-cmake/blob/master/packages/mpv-release.cmake#L50C9-L50C23

When this code runs, files were not yet passed to libmpv, files are loaded later!

At least the directory is accessed from what is visible in procmon. Also this is the first time I have experienced this error.

getting this error with files on same drive; lots of media files in folder and long names.