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

Mac: Not works out of the box #48

Closed
eko5624 opened this issue Oct 29, 2022 · 20 comments
Closed

Mac: Not works out of the box #48

eko5624 opened this issue Oct 29, 2022 · 20 comments

Comments

@eko5624
Copy link

eko5624 commented Oct 29, 2022

Workaround:
ln -s /Applications/mpv.app/Contents/MacOS/mpv /usr/local/bin

Is there another way to fix this?

@po5
Copy link
Owner

po5 commented Oct 29, 2022

Does the script work fine after running that command?
I guess we just have to make more of an effort to find the actual path to the mpv executable.
This is also an issue on Windows for users that haven't added mpv to path.

@hooke007
Copy link
Contributor

This is also an issue on Windows for users that haven't added mpv to path.

No, as a windows portable mpv user, I can confirm that the script works well even though out of PATH.

@po5
Copy link
Owner

po5 commented Oct 29, 2022

It is, for those who don't have it in path and are launching mpv from outside its own directory.

eko: Does replacing "mpv" with "/Applications/mpv.app/Contents/MacOS/mpv" on this line also work?

"mpv", path, "--no-config", "--msg-level=all=no", "--idle", "--pause", "--keep-open=always", "--really-quiet", "--no-terminal",

Will try to add auto detection of the currently running executable path for a not-too-messy solution.

@hooke007
Copy link
Contributor

eko: Does replacing "mpv" with "/Applications/mpv.app/Contents/MacOS/mpv" on this line also work?

hooke007/MPV_lazy#186 (comment)
We actually tested before and it worked.

The only problem is the bundle app can be placed anywhere, we didn't find the solution to check it.

@christoph-heinrich
Copy link
Contributor

The docs mention ~~osxbundle/ for Mac and ~~exe_dir/ for Windows.

@hooke007
Copy link
Contributor

hooke007 commented Oct 29, 2022

see mpv-player/mpv#10009 ~~exe_dir/ couldn't work for me.

Another info we noticed in that thread is the old thumbnailer(worker) doesn't have this issue(Mac).

@po5
Copy link
Owner

po5 commented Oct 29, 2022

Another info we noticed in that thread is the old thumbnailer(worker) doesn't have this issue.

At first glance this uses the exec_path variable which is user-defined, with a default value of

((os.getenv('PWD') or mp.get_property('working-directory')) .. ':' .. os.getenv('PATH'))

I've used functionally similar code before, but I don't know if that's enough to find the mpv path on Mac.

https://github.com/po5/audio_background/blob/85e7f3364aadc5ef4fd34cb091519003afd0f837/audio_background.lua#L35-L57

@christoph-heinrich
Copy link
Contributor

We already have the PID. There has got to be a way of getting the path from the pid on every OS. On linux readlink /proc/<pid>/exe gives you the executable path, but no idea how to do it on mac or windows.

@po5
Copy link
Owner

po5 commented Oct 29, 2022

on my arch system:

$ ps -o comm= -p PIDHERE
mpv

$ which mpv
/usr/bin/mpv

Is that enough on Mac?

stackoverflow says this could work:

realpath /proc/PIDHERE/exe

@eko5624
Copy link
Author

eko5624 commented Oct 30, 2022

ln -s /Applications/mpv.app/Contents/MacOS/mpv /usr/local/bin

Yes, after running this command it works well on my Mac.

@po5
Copy link
Owner

po5 commented Oct 30, 2022

Can you install thumbfast from the mac-test branch (https://github.com/po5/thumbfast/blob/mac-test/thumbfast.lua), and try the following:

Open a file in mpv through the terminal, hover on the timeline once.
Copy the PID displayed in terminal.
Open a second terminal, don't close mpv.
Run realpath /proc/PID_HERE/exe (replace PID_HERE)
Run ps -o comm= -p PID_HERE (replace PID_HERE)
Run which RESULT_OF_PREVIOUS_COMMAND (replace RESULT_OF_PREVIOUS_COMMAND with result of ps command above)

Post the output of the 3 commands you ran.
Hopefully that will get us the path to mpv, wherever it happens to be installed, on a Mac system.

@eko5624
Copy link
Author

eko5624 commented Oct 30, 2022

/Applications/mpv.app/Contents/MacOS/mpv /Volumes/USB/Downloads/星际穿越.mkv 
Cannot find main.* for any supported scripting backend in: /Users/huangjiajia/.config/mpv/scripts
[thumbfast] script-opts/thumbfast.conf:8 unknown key 'tnpath', ignoring 
[thumbfast] script-opts/thumbfast.conf:29 unknown key 'min_duration', ignoring 
[thumbfast] script-opts/thumbfast.conf:31 unknown key 'precise', ignoring 
[thumbfast] script-opts/thumbfast.conf:33 unknown key 'frequency', ignoring 
[uosc] script-opts/uosc.conf:126 unknown key 'font_height_to_letter_width_ratio', ignoring 
[thumbfast] PID 6850 

Open second terminal:

huangjiajia@huangjiajiadeMacBook-Pro ~ % realpath /proc/6850/exe
realpath: /proc/6850/exe: No such file or directory
huangjiajia@huangjiajiadeMacBook-Pro ~ % ps -o comm= -p 6850
/Applications/mpv.app/Contents/MacOS/mpv
huangjiajia@huangjiajiadeMacBook-Pro ~ % which /Applications/mpv.app/Contents/MacOS/mpv
/Applications/mpv.app/Contents/MacOS/mpv

@po5
Copy link
Owner

po5 commented Oct 30, 2022

What about the ps+which commands (:

@eko5624
Copy link
Author

eko5624 commented Oct 30, 2022

I reedited, please take a look.

@po5
Copy link
Owner

po5 commented Oct 30, 2022

Seems like ps -o comm= -p PID_HERE would do the trick! Thanks for helping out.

@po5
Copy link
Owner

po5 commented Oct 30, 2022

Does the script work out of the box on the latest commit?

@hooke007
Copy link
Contributor

Yes

@po5 po5 closed this as completed Oct 30, 2022
@eko5624
Copy link
Author

eko5624 commented Oct 30, 2022

Weird thing, when hovering on the timeline, there's one more mpv icon popped up on dock, like this:
QQ20221030-133833@2x

@LampPrinter
Copy link

Weird thing, when hovering on the timeline, there's one more mpv icon popped up on dock, like this: QQ20221030-133833@2x

Is there a solution to this?
Whenever thumbnails get generated playing any video in MacOS, I get 2 more MPV icons in dock.
Kinda irritating.

@po5
Copy link
Owner

po5 commented Apr 29, 2023

Another info we noticed in that thread is the old thumbnailer(worker) doesn't have this issue(Mac).

I've been able to set up a Mac VM and try this out. It doesn't even work out of the box, and the reason it doesn't generate extra icons is because it uses ffmpeg by default?
I'll commit a solution that properly picks up on the symlink if the user made it.

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

5 participants