-
Notifications
You must be signed in to change notification settings - Fork 51
Installation on Windows
IMPORTANT: Windows support is second-class. Feel free to open issues, but be advised that they won't be worked on unless someone else on Windows decides to fix them.
IMPORTANT: The Ruby native client does not work on Windows. You'll need to use the Python native client, which is included in the steps below and all helper scripts.
- python3 (3.8 or above)
- mpv
- git
- youtube-dl / yt-dlp
You must have the listed dependencies above on your system. You can verify them by entering python --version
, mpv --version
, git --version
, yt-dlp --version
, youtube-dl --version
into a Powershell / Command prompt window.
You can install python
from the Microsoft store, or through the download page. Notice that on Windows 10/11 systems the command python
and python3
are available as a shortcut to the Microsoft Store and this will cause a false positive in the install script.
WARNING: If you install python from the Microsoft Store and want to access the location of the python executable or any of its subdirectories, make sure to NEVER change the permissions of the WindowsApps
directory (C:\Program Files\WindowsApps) or all the apps from the store may stop working (including the store itself). In the case you need access to those files it is recommended to install from Python's website and follow the wizard.
For mpv
, you can install it from the official releases, Chocolatey, or Scoop.
For git
, you can install Git for Windows or the distributed version in Chocolatey or Scoop.
You will need either yt-dlp
(recommended) or youtube-dl
. You can use pip from python to install it e.g. python -m pip install [package_name]
or you can use the distributed version in Chocolatey or Scoop.
NOTE: If you choose yt-dlp
you will need to provide its path to mpv.
- Option1: Put
yt-dlp
it in same folder where mpv.exe resides. - Option2: Create a mpv.conf file. Go to
appdata
folder (win + r and type %appdata%, then enter). Look for a directory called mpv or make one if none exists. There add a new file calledmpv.conf
or edit it if you already have one. Add this linescript-opts=ytdl_hook-ytdl_path=yt-dlp
and save. For this to workyt-dlp
needs to be accesible in your path.
- Python 3.8 from store, mpv from scoop, and git bash for Windows.
- Python 3.10 from python's website, mpv from chocolately, and git bash for Windows.
You will need to clone the repository using git or download it as a zip.
- Option 1: Clone the repository to any place to PC (user home recommended). Open powershell and navigate to the directory where the repository will be cloned (cd $HOME for example). Use the command
git clone https://github.com/woodruffw/ff2mpv.git
to start cloning. - Option 2: Download as a zip. Go to home page and look for a green button in the upper right corner labeled as
code
. There you will have an option to download as a zip. Download wherever you want and extract its content to a folder.
For Firefox you can get it from AMO.
For Chrome and chromium based browsers use the chrome store.
Optionally you can check the documentation of your browser and load the extension manually from the repository (will require enabling developer options in your browser).
The installation through the powershell script is the recommended way as it supports most used browsers and it also allows custom browsers.
Go to the directory where you cloned the repository in powershell (e.g. type cd $HOME\ff2mpv
and hit enter if you cloned it in your user directory).
Once in this directory call the script with the following syntax.
.\install.ps1 [browser] [optional registry path for "custom"] [-help] [-uninstall]
The script provides the registry location automatically for the following browsers:
- firefox
- chromium
- chrome
- edge
For custom installations see the point "Custom browser installs".
Let's say I want to install the extension for firefox, then the command will be:
.\install.ps1 firefox
If you have doubts when running the script, you can use -help
flag to display more information about the syntax.
.\install.ps1 -help
For custom browsers it is required that you know the location for the registry path for the NativeMessagingHosts
of your browser. You can check on their official website for more information.
In this example lets suppose that I want to install Chrome as a custom browser. In the official documentation of chrome I can find the path for the NativeMessagingHosts
registry key in the location HKEY_CURRENT_USER\SOFTWARE\Google\Chrome
. However, in order to let powershell know we are providing a registry path, we need to append Registry::
at the start of the registry path. Thus the path will look like Registry::HKEY_CURRENT_USER\SOFTWARE\Google\Chrome
.
Once we know the path for the registry, we can use the script with the following syntax.
.\install.ps1 custom "Registry::HKEY_CURRENT_USER\SOFTWARE\Google\Chrome"
Now the script will know where to find the browser's NativeMessagingHosts
path in the registry.
If you get any error regarding execution policy, see Set-ExecutionPolicy cmdlet. By default Windows blocks all unsigned scripts to protect users.
An example for dealing with this error is:
- Open powershell as administrator (on Win10/11 you can right click on start button, then open powershell admin)
- Enter the command
Set-ExecutionPolicy Bypass
- Continue to use the admin powershell or open a new one with use privileges and follow the steps above again.
WARNING: Setting Execution policy to Bypass
will allow you to run all ps1 scripts. Be careful if you choose that option or set the scope to the current process only Set-ExecutionPolicy Bypass -Scope Process -Force
(you should continue in the current powershell instance). Either way everything is done at your own risk.
Installations with the script are less error prompt and will have the following benefits:
- Manage the JSON files and its paths for the registry value. Thus preventing conflicts if using the add-on in more than one browser.
- Check for the different python commands available in the pc. It will update the
ff2mpv.bat
file automatically. - Provide useful messages to help troubleshoot issues.
- Install the add-on from AMO and download the repository in your PC if you haven't already. Check the steps above Getting the repository and Getting the ff2mpv add-on for more information.
- Open the Registry Editor through the start menu or open Run (win + r keys) and type
regedit
. - Go to
HKEY_CURRENT_USER\SOFTWARE\Mozilla\NativeMessagingHosts
and add a registry key for ff2mpv. The value should be the location of theff2mpv-windows.json
file. Example:C:\Users\thomastay\ff2mpv\ff2mpv-windows.json
- Install the extension from the chrome store and download the repository in your PC if you haven't already. Check the steps above Getting the repository and Getting the ff2mpv add-on for more information.
- Open the Registry Editor through the start menu or open Run (win + r keys) and type
regedit
. - Go to the location of the
NativeMessagingHosts
. Known locations:- Chrome: HKEY_CURRENT_USER\SOFTWARE\Google\Chrome\NativeMessagingHosts
- Chromium: HKEY_CURRENT_USER\SOFTWARE\Chromium\NativeMessagingHosts
- Edge: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Edge\NativeMessagingHosts
- For other browsers please read the documentation of your browser in the official website.
- Create a new key and call it
ff2mpv
. The value for the for the key should be the full path for theff2mpv-windows.json
file. If you cloned it in your home folder, it should be something likeC:\Users\[YOUR USER NAME]\ff2mpv\ff2mpv-windows.json
- Modify your
ff2mpv-windows.json
. Open the file and replace theallowed_extensions
withallowed_origins
like in the example below
{
"name": "ff2mpv",
"description": "ff2mpv's native manifest",
"path": "ff2mpv.bat",
"type": "stdio",
"allowed_origins": [
"chrome-extension://ephjcajbkgplkjmelpglennepbpmdpjg/"
]
}
IMPORTANT: Due to incompatibility issues with allowed_origins
in Firefox, it is not possible to use the same ff2mpv-windows.json
file for both browsers. However, you can enable the extension to work with both browsers by copying ff2mpv-windows.json
and modifying the copy as described in the Chrome instructions. You can have something like ff2mpv-windows.json
for Firefox and ff2mpv-windows-chrome.json
for Chrome. Just make sure to use the correct name in the registry keys.
When the "Play in MPV" is clicked on the browser, this looks in the registry to find the json file you linked. It then launches ff2mpv.bat, which is a shim file that runs python ff2mpv.py
.
- The file launched by by the browser must be a batch file (.bat). A Powershell script (.ps1) will not work (you can change windows settings of handling ps1 files which by default will open them with notepad, however this approach is not recommended unless you know what you are doing).
- If any of the intermediate folders in the registry e.g.
HKEY_CURRENT_USER\SOFTWARE\Mozilla\NativeMessagingHosts
does not exist, just create a new registry key, that makes a folder. - Make sure that ff2mpv.bat is calling python correctly. Depending of how you installed it, the python command could be
python
orpython3
and optionallypy
if you installed the python launcher. Also verify this is accessible in your path as stated in the Prerequisites - If you are modifying your path but you don't see changes (e.g.
echo $env:path
). Try closing your current powershell instance. Some terminals like Windows Terminal will prevent the path to be updated until the terminal is restarted. - Make sure you can run the install.ps1 script in powershell by setting the right Execution Policy permissions. See the section Execution Policy Errors
To uninstall (remove the registry key) with the powershell script run the command as if you where installing but append the flag -uninstall
at the end. Following the install examples it will be
.\install.ps1 firefox -uninstall
or
.\install.ps1 custom "Registry::HKEY_CURRENT_USER\SOFTWARE\Google\Chrome" -uninstall
You can also manually remove the registry key entry in the registry editor.
After that just remove the folder where the ff2mpv
repository is located and don't forget to remove the extension in the browser from your add-ons/extensions tab.