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

Does not work on brave-browser #98

Closed
beew opened this issue Mar 3, 2023 · 13 comments
Closed

Does not work on brave-browser #98

beew opened this issue Mar 3, 2023 · 13 comments
Labels
B:chromium Support for Chromium-based browsers bug-candidate maybe a bug; not confirmed needs information P:linux

Comments

@beew
Copy link

beew commented Mar 3, 2023

When click the ff2mpv icon nothing happens

start brave from the terminal, go to Youtube and click the ff2mpv icon, got these error messages

mpv: symbol lookup error: mpv: undefined symbol: vkCreateXlibSurfaceKHR

OS is Ubuntu 22.04

Brave version 1.48.171 (based on Chromium 110.0.5481.177 )

mpv version

$ mpv
mpv 0.35.1 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
 built on Tue Feb 28 04:54:15 2023
FFmpeg library versions:
   libavutil       58.2.100
   libavcodec      60.3.100
   libavformat     60.3.100
   libswscale      7.1.100
   libavfilter     9.3.100
   libswresample   4.10.100
FFmpeg version: 6.0-0ubuntu1~22.04.sav0

addition info

  1. mpv works on local video, streaming through command line and ff2mpv works on firefox.

  2. I have disabled brave's adblocker and re-eanbled it. Still doesn't work

  3. this mpv addon does work for brave
    https://chrome.google.com/webstore/detail/play-with-mpv/hahklcmnfgffdlchjigehabfbiigleji

@beew beew added the bug-candidate maybe a bug; not confirmed label Mar 3, 2023
@woodruffw
Copy link
Owner

Thanks for the report! Which native client are you using, and are you using any special arguments / MPV profiles with it?

@woodruffw woodruffw added needs information P:linux B:chromium Support for Chromium-based browsers labels Mar 3, 2023
@beew
Copy link
Author

beew commented Mar 4, 2023

Hi, thanks for the reply.

I am not sure what you meant by native client. It is pretty much stock brave-browser.

My mpv config is pretty basic

vo=gpu 
hwdec=vaapi

volume-max=120 
ao=pulse

ytdl-format=bestvideo[height<=?1080][vcodec!*=av01]+bestaudio/best

@beew
Copy link
Author

beew commented Mar 4, 2023

Hi,

I found out the reason that it wasn't working is that chromium based browsers include their own libvulkan which is broken.
https://www.reddit.com/r/mpv/comments/ry9sgi/i_keep_getting_this_error_when_opening_mpv_on/

It is not clear from that thread why running mpv would invoke chrome's libvulkan (in my case mpv works fine except through brave with ff2mpv), but the error message is the same.

I fixed it with a wrapper script for mpv like in one of the anwers

#!/bin/bash

export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libvulkan.so.1

/usr/bin/mpv "$@"

Now ff2mpv works for both brave and firefox.

Instead of using the wrapper, can this be done by editing ff2mpv.py?

@woodruffw
Copy link
Owner

Thanks for root-causing. My guess there is that the mpv process inherits its runtime environment from a browser worker/extension management process, which means that we end up with whatever that environment specifies for load order.

I am not sure what you meant by native client.

The native client is the thing named either ff2mpv.py or ff2mpv that the extension executes to actually spawn mpv. It's installed by the installer script.

So yes, this can be done by editing ff2mpv.py. I'd suggest documenting any changes you make on the community-maintained ff2mpv wiki 🙂

@sudoshindo
Copy link

sudoshindo commented Jan 14, 2024

Same issue with Brave on Fedora 39.

@beew How do I make this wrapper script work and where do I put it?

Both this and Thann/play-with-mpv are broken.
What an absolutely horrible time this is.

@beew
Copy link
Author

beew commented Jan 14, 2024

Same issue with Brave on Fedora 39.

@beew How do I make this wrapper script work and where do I put it?

Both this and Thann/play-with-mpv are broken. What an absolutely horrible time this is.

Hi,

I posted the script above.

Name it mpv, make it executable and place it in a directory in your $PATH that overrides /usr/bin. This way when you invoke mpv say by typing mpv in the terminal it runs the script instead of /usr/bin/mpv

In Ubuntu you can put the script in either ~/bin or ~/.local/bin. I am not sure about Fedora, you may need to add the path to your .profile or .bashrc then logout and login if it is not already there. /usr/local/bin is fine too but that needs sudo and I think Fedora doesn't respect /usr/local.

my .profile looks like this


if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

See "set Path so it includes user's private bin if exists". If they don't exist create them then logout and login for it to take effect

@sudoshindo
Copy link

I found a way to make the other extension work (Thann/play-with-mpv) but thanks anyway.

@beew
Copy link
Author

beew commented Jan 14, 2024

I found a way to make the other extension work (Thann/play-with-mpv) but thanks anyway.

I used to use that one but I switched because it spawned some zombie processes after playing the video. Check with top.

@woodruffw
Copy link
Owner

This is an independent manifestation of #109. It looks like both Chrome-type browsers and Firefox have this problem, albeit with different interfering libraries.

I have no good ideas for a fix here, other than doing some additional process isolation when spawning mpv (maybe we could further filter the parent's environment)?

@woodruffw
Copy link
Owner

Closing in favor of continued tracking on #109.

@beew
Copy link
Author

beew commented Jan 14, 2024

This is an independent manifestation of #109. It looks like both Chrome-type browsers and Firefox have this problem, albeit with different interfering libraries.

I have no good ideas for a fix here, other than doing some additional process isolation when spawning mpv (maybe we could further filter the parent's environment)?

I have no problem with Firefox. But I grabbed firefox from Mozilla (tarball) to avoid snap. Not sure how they installed it.

@woodruffw
Copy link
Owner

I have no problem with Firefox. But I grabbed firefox from Mozilla (tarball) to avoid snap. Not sure how they installed it.

Yeah, I suspect that this is some of the problem. I also avoid the snap-ified Firefox and haven't had problems.

@sun95n
Copy link

sun95n commented Jan 28, 2024

Instead of using the wrapper, can this be done by editing ff2mpv.py?

Yes, just add it as an argument, something like:

args = ["env", "LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libvulkan.so.1", "mpv", url]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B:chromium Support for Chromium-based browsers bug-candidate maybe a bug; not confirmed needs information P:linux
Projects
None yet
Development

No branches or pull requests

4 participants