-
Notifications
You must be signed in to change notification settings - Fork 52
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
[Windows] Works on Firefox but not on Chrome #99
Comments
Thanks for the report; I don't use ff2mpv on either Windows or Chrome so I'll leave the community to triage that bit. CC @eNV25 in particular, since they originally added that functionality.
You can do something similar to the "audio only" trick, documented here: https://github.com/woodruffw/ff2mpv/wiki/How-to-just-play-audio-in-mpv-with-GUI If you get it working, please add your example to the wiki! |
Thanks for the quick reply. Let's see if eNV25 can help with Chrome. About subtitles, I have followed the instructions, changing the ff2mpv.py script "args" line to this: Then I have added this to mpv.conf file:
It works for all YouTube videos with auto-generated subtitles, but it doesn't work for YouTube videos with predefined subtitles. |
I don't use Windows. @DanSM-5 Added the |
I think I cracked the subtitles part. How could I add it to the wiki? I'm not used to such things. Here's the working code: ff2mpv.py file: mpv.conf file:
The Now I only need some help with Chrome. It all works great with Firefox. |
Just tried reinstalling ff2mpv and the script is working for me in Chrome. Based on the output it looks like it was installed successfully. @JoseHidalgo would you mind running the following commands in powershell and copying the output here? # Command 1
Get-Content .\ff2mpv-windows-chrome.json
# Command 2
Get-Content .\ff2mpv.bat
# Command 3
Test-Path 'Registry::HKEY_CURRENT_USER\SOFTWARE\Google\Chrome\NativeMessagingHosts\ff2mpv'
# Command 4
Get-Item 'Registry::HKEY_CURRENT_USER\SOFTWARE\Google\Chrome\NativeMessagingHosts\ff2mpv' The output should be something like this: PS C:\ff2mpv> Get-Content .\ff2mpv-windows-chrome.json
{
"name": "ff2mpv",
"description": "ff2mpv\u0027s native manifest",
"path": "ff2mpv.bat",
"type": "stdio",
"allowed_origins": [
"chrome-extension://ephjcajbkgplkjmelpglennepbpmdpjg/"
]
}
PS C:\ff2mpv> Get-Content .\ff2mpv.bat
@echo off
call py -3 ff2mpv.py
PS C:\ff2mpv> Test-Path 'Registry::HKEY_CURRENT_USER\SOFTWARE\Google\Chrome\NativeMessagingHosts\ff2mpv'
True
PS C:\ff2mpv> Get-Item 'Registry::HKEY_CURRENT_USER\SOFTWARE\Google\Chrome\NativeMessagingHosts\ff2mpv'
Hive: HKEY_CURRENT_USER\SOFTWARE\Google\Chrome\NativeMessagingHosts
Name Property
---- --------
ff2mpv (default) : C:\ff2mpv\ff2mpv-windows-chrome.json Additionally, you can see if chrome gets an error looking at the background page of the extension. Go to the 3 dot button on the top right corner > more tools > extensions > look for ff2mpv and click on 'Background page'. It will open chrome dev tools for the extension (See image). Once open try to use the extension in chrome and look if something gets logged to the console. |
There should be an "edit" button on each page in the wiki. You can use the editor that that button opens to make the changes. That said, if you aren't able to figure it out, don't worry -- I'll do it in a day or so. |
@woodruffw I need a bit of time to figure out the subs part. So far it kinda works on videos with auto-generated subs, and on SOME videos with predefined subs, but it still doesn't work on most videos with predefined subs. Trying to get some help on Reddit as we speak: https://www.reddit.com/r/mpv/comments/1367gh0/mpvconf_display_youtube_english_subtitles_either/ @DanSM-5 we're making some progress :) Here's the PowerShell output: And here's the background page output. There's a "File Not Found" error: |
@JoseHidalgo Thanks for the output. Everything that has to do with the native client seems fine. In the background page the warning in yellow is not important. It just failed to load a source map for debugging. However the second line Error: Failed to start native messaging host. is an important clue about the issue. A quick search about it I found this question in stack overflow. It seems that the issue may be due to windows 7 not having the environment variable ComSpec set up. You could try it yourself with the command:
In my case it returns the location of cmd.exe:
If you don't get anything, you may need to add it yourself. setx /m ComSpec "C:\WINDOWS\system32\cmd.exe" The |
@DanSM-5 understood. I have just checked, and apparently ComSpec is already set up in my system, no need to do anything unless you want me to: Also, let's remember that this issue is Chrome-specific. With Firefox everything works fine. |
Yes, those questions in stack overflow are chrome specific. I think we can roll out the ComSpec variable. In that question it also points out that for Windows 7 it was needed to remove a lock icon (change permissions) of the As per chrome documentation:
I think it is worth to check if the files generated by the script are accesible for chrome. Try changing the permission of |
Could you try to add the user You can also compare the permissions by looking at the output of the command You could try to copy the permissions from the ff2mpv-windows.json file to others to see if that helps: Get-Acl -Path ./ff2mpv-windows.json | Set-Acl -Path ./ff2mpv-windows-chrome.json As last resource you can try recreating the files manually in case some encoding error may be affecting the files. Just delete both ff2mpv.bat and ff2mpv-windows-chrome.json and create new files in notepad with this content: ff2mpv.bay
ff2mpv-windows-chrome.json {
"name": "ff2mpv",
"description": "ff2mpv's native manifest",
"path": "ff2mpv.bat",
"type": "stdio",
"allowed_origins": [
"chrome-extension://ephjcajbkgplkjmelpglennepbpmdpjg/"
]
} |
Just taking a step back for a second: are you able to confirm that other native extensions work correctly in Chrome on Windows 7? It's possible that the feature as a whole is broken/slightly wonky on older Windows versions, since Chrome likely doesn't have automated tests for it. |
Nope, sorry for the confusion -- I was suggesting that you might want to try a different extension that uses native messaging (a lot of password manage extensions do, for example), and see if it's working. (I don't actually know one off the top of my head, since I only use ff2mpv on Firefox and it's the only native messaging extension I use. But my guess is that 1Password and similar applications use it for their browser extensions.) |
I agree with @woodruffw, I think the next step is verifying that native messaging hosts is working on chrome for windows 7. @JoseHidalgo Some extensions like ff2mpv use the native messaging hosts to communicate with the native applications in the computer like in this case to send the url to mpv. The only other extension I use that talks to a native application is KeepassXC browser. You could review this by opening the registry and looking at chrome's entries in Also for more logs in chrome you can launch it with the argument |
Try it in other Chromium-based browsers, like Edge or Brave. Maybe that behaves differently. |
@JoseHidalgo what I meant by checking the registry is to find other extensions that implement native messaging hosts. Could you confirm that the other extensions there are working? Do they interact with the native application (the application installed in windows)? |
I manage to get it to work on brave-browser (chromium based like google chrome) on Linux. The issue arises because chromium based browsers bundled their own libvulkan which is broken (on Linux?) #98 Not sure if the cause is the same on WIndows and if it is whether you can modify it to works on Windows as I haven't used Windows for years. |
I've checked Chrome's log. Here's the error that lies within:
I can provide the whole log if needed, but that is the only mention of ff2mpv. Every time I click on the icon, a new mention is added to the log. And yes, AFAIK my other apps using native messaging hosts work normally with Chrome (e.g. Dropbox). Maybe it's library-based like @beew just said? |
Maybe chrome changes the PATH environment variable and the script can't find python. |
That's unrelated. That's Linux specific. |
Yesterday I looked at the issue pointed by @beew. What I understand from it is that starting mpv from a chrome process makes it inherit its environment which was overriding an important library for mpv and thus making it fail to play. I cannot say for sure but I've confirmed no issues on Windows 10 and 11 so if this were to be the case, it is a windows 7 only thing. From the logs provided by @JoseHidalgo I see that the main issue is related to |
@JoseHidalgo can you try other chromium based browsers like Brave or Edge? |
I'll see what I can do. Give me a couple of days, we have guests staying at home. Will report back ASAP. |
@eNV25 Reporting about my Win 7 system:
So this issue seems to be Chrome-specific. |
Given that this is a Chrome + Windows-specific bug, I'm going to triage this as a potential upstream issue. |
@JoseHidalgo is your chrome perhaps a 32 bit version? |
Then try uninstalling it and installing it again, making sure to get the 64-bit version. |
Wouldn't that make me lose all my settings, extensions, tabs, passwords and such? |
Don't you have a Google account with data sync turned on? If so, everything should be restored if/when you reinstall. |
OK, so I've safely synced / uninstalled / reinstalled Chrome 64-bit. Now it has found its proper place under Program Files. Unfortunately the ff2mpv-related issue remains the same. Just checked the background info, same exact error. |
Also, @woodruffw I think I have finally found the right syntax for subtitles:
2.1. Put this in mpv.conf:
2.2. Call the now defined youtube profile in command line : Those two examples are valid for english subtitles. For other languages the relevant parts need to be adapted. Feel free to add this to the wiki if you want. |
Glad to hear you got it working! I'll add that tonight. |
Yes, the subtitle part works, and ff2mpv itself works well on Firefox and Brave. Only Chrome's issue remains though. |
I've added it to the wiki here: https://github.com/woodruffw/ff2mpv/wiki/Customization-tricks#adding-subtitles-to-videos |
I've just run Windows 7 in a virtual machine. The install script failed because some modules in powershell that the script expects are missing, so I proceded to install manually (add registry key, create ff2mpv.bat, create ff2mpv-windows-chrome.json). I got the extension working fine. See gif: Programs:
@JoseHidalgo I think there must be something in your windows installation that is breaking the native messaging hosts for chrome. |
Thanks Eduardo @DanSM-5 , noted. Thankfully it doesn't bother me anymore, because thanks to the suggestions in this thread I have now officially switched to Brave Browser, so I don't use Chrome anymore. And I don't miss it one bit. If the issue is something deep within my particular install of Win 7, then trying to find it is probably not worth it, since I'll be switching to Win 11 in a few months tops. Thanks for all your efforts to find the issue! |
I believe there's nothing left to be resolved here/nothing actionable on our part, so closing. |
Hi, I have successfully installed everything following the detailed "Installation on Windows" instructions:
ISSUE 1:
It works perfectly from Firefox (when clicking on the ff2mpv icon in, say, a YouTube page).
It doesn't work on Chrome (when clicking on the ff2mpv icon nothing happens). Since I have no error message I don't know what to do.
Why would it work on Firefox but not on Chrome?
ISSUE 2:
I'd like english subtitles to be added automatically in MPV.
In command line, this works perfectly:
mpv {YouTube URL} --slang=en --ytdl-raw-options=ignore-config=,sub-lang=en,write-auto-sub=
How could I achieve the same thing using ff2mpv?
Platform information
Additional context (optional)
The text was updated successfully, but these errors were encountered: