-
Notifications
You must be signed in to change notification settings - Fork 52
Common problems
This page documents common problems when using ff2mpv and how to diagnose and correct them.
TODO: Document the following common problems:
- Failing to install the native client
-
youtube-dl
not being installed at all
Some Linux users have reported problems with ff2mpv's ability to spawn mpv
and/or youtube-dl
when Firefox is launched via a "desktop" launcher (e.g. an icon corresponding to a .desktop
file). It's not clear what causes this, but it is not a bug in ff2mpv itself: it happens at the system level.
To confirm that you're having this problem, try running Firefox from a terminal emulator (i.e., just run firefox
). If ff2mpv functions correctly when Firefox is run like this, it's probably a launcher issue.
The "fix" for most launcher issues appears to be opening Firefox's .desktop
file and removing %U
from the Exec=
line. It's not clear why this fixes things.
Alternatively, consider using a simplified launcher like dmenu
or rofi
. These don't appear to have problems.
Follow the default installation guide.
Then, execute:
cp -r .mozilla/native-messaging-hosts/ .librewolf/
On Linux and macOS, mpv
and youtube-dl
need to be on the PATH
in order for ff2mpv to function correctly.
To confirm that mpv
is on the PATH
, you can run:
$ which mpv
/path/to/some/folder/mpv
If which
doesn't print a path, then mpv
is not on the PATH
. You'll need to take steps specific to your OS, distribution, environment, and/or package manager to resolve it.
NOTE: Do not open issues asking ff2mpv to support a particular website or URL. ff2mpv has no control over the URLs supported by your mpv
and youtube-dl
installations.
ff2mpv sends URLs to mpv
, which in turn sends them to youtube-dl
for extraction. That means that either mpv
or youtube-dl
can fail for a particular website, causing ff2mpv to not work.
If a website ceases to work with ff2mpv, there's a good chance that your version of youtube-dl
no longer works with the current version of the site. youtube-dl
is frequently updated; you can find directions for updating your installed copy here.
If updating youtube-dl
doesn't work, the problem might be mpv
itself. You should use your package manager to update it.
It's been observed that Brave in windows and macos do not use its corresponding entry for the native messaging host entry but rather it reads Google Chrome's entry. Brave and other chromium based browsers may do this to keep compatibility with extensions from the Chrome's extension store.
The workaround is to use Chrome's entry when installing the json manifest. If you use the install script this means to simply use chrome
as the argument e.g. ./install.sh chrome
.
This happens because the child process that calls the native messaging hosts is inheriting environment variables from the browser. The way nix handle dependencies to isolate programs often involves setting LD_LIBRARY_PATH
and LD_PRELOAD
.
The issue happens when those variables propagate to other programs at the moment they are being executed as those libraries are not the versions that the called program expects. This results in weird and unhelpful logs most commonly segfaults
.
The first and obvious workaround is to use a browser packaged for your distribution using apt
, pacman
, dnf
, etc. rather than nix
.
Or maybe in the future native messaging hosts may work with flatpak
when the PR gets merged.
But this "browser" is not available for my distribution!
There is a workaround by unsetting the problematic variables, then continue with the flow of the native messaging host. For that you will need to modify the json manifest to point to a script instead of your backend of choice (python, ruby, go, rust). Locate the directory native-messaging-hosts
(firefox and derivatives) or NativeMessagingHosts
(chrome and derivatives) there you'll find the json manifest ff2mpv.json. Change the value of the key path
from the backend to a script. For the sake of simplicity we will call the script ff2mpv.sh
.
An unmodified manifest will look like this (firefox like manifest)
{
"name": "ff2mpv",
"description": "ff2mpv's external manifest",
"path": "/path/to/backend/ff2mpv", // Modify this value
"type": "stdio",
"allowed_extensions": ["ff2mpv@yossarian.net"] // chromium manifest will have "allowed_origins" instead
}
Take note of the path to the backend and change the name of the file to ff2mpv.sh
.
Navigate to that path (it is usually the location where you download ff2mpv repo). Create a file called ff2mpv.sh
and open it with your text editor of choice.
Add the following content.
#!/usr/bin/env sh
# These are the problematic variables that you may want to unset.
# You may need only one, both, or maybe more depending on how nix is handle things.
# Here I unset both.
unset LD_PRELOAD
unset LD_LIBRARY_PATH
# If you installed something else with nix e.g. python3, mpv, yt-dlp, etc.
# You need to add the `bin` directory of nix to your path. You can locate it with `which <PROGRAM NAME>`.
# A common place is `~/.nix-profile/bin`. This checks if the directory exists and adds it to the path.
# [ -d "$HOME/.nix-profile/bin" ] && export PATH="$PATH:$HOME/.nix-profile/bin"
# Call the backend using exec.
# This is an example using the python backend
exec python3 ff2mpv.py