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

Subtitles render under mpv window on macOS #42

Closed
10 of 12 tasks
2V3EvG4LMJFdRe opened this issue May 15, 2021 · 21 comments
Closed
10 of 12 tasks

Subtitles render under mpv window on macOS #42

2V3EvG4LMJFdRe opened this issue May 15, 2021 · 21 comments

Comments

@2V3EvG4LMJFdRe
Copy link

Trying to get this script to work. I'm on macOS and have manually installed these:

  • Xorg
  • composite manager; xcompmgr or sth.
  • python => 3.6
  • python-pyqt5 (with pip)
  • python-numpy (with pip)
  • python-beautifulsoup4 (with pip)
  • python-requests (with pip)
  • python-lxml (with pip)
  • python-httpx (with pip)
  • lua (with brew)
  • socat (with brew)
  • pkill (with brew)

The ones I haven't marked, I didn't know how to install. In any case, a console instance kept informing me on what package was missing when I ran the script, until there were no errors. However, when I start the script still I just get no input beyond the subtitles disappearing and the prompt stating its started.

I tried multiple videos, .srt files, downloaded a clean mpv build, tried the deprecated tk version, but it makes no difference. The only thing that changes is using "python3" has no errors on the console, while "python" complains about:

[interSubs] Starting interSubs ... 
AV: 00:57:39 / 01:49:43 (53%) A-V:  0.000 Dropped: 10
Saving state.
  File "/Users/redacted/.config/mpv/scripts/interSubs.py", line 84
SyntaxError: Non-ASCII character '\xc2' in file /Users/redacted/.config/mpv/scripts/interSubs.py on line 84, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
@2V3EvG4LMJFdRe
Copy link
Author

I installed xdotools per suggestion in this thread. After this, I tried once again and some really funny stuff happened were python opened up in the dock and I got two windows, separate from mpv, one rendering one word of the subtitle, and the other showing its meaning.

Sat May 15 02:24:09 -04 2021

Somehow I can't reproduce it again, but there's that.

@oltodosel
Copy link
Owner

About python3 changing to python - is seems that the change isn't necessary now as it was years ago. I don't have Mac, so I can't say for sure.

About separate window - I've no idea why this happens. Maybe something to do with settings and your MacOS does not allow undecorated windows to show.

Subtitles invisible but work as I understand? In that case it has something to do with compositor's settings. I'd look in that direction.

@2V3EvG4LMJFdRe
Copy link
Author

Yes, they work, it's just the way they're rendered that doesn't allow me to make use of them. The issue is in fact, that the subtitles are rendered outside mpv. With a default mpv and script, they don't show up at all. If I make the two changes suggested here and here, they render functional, but outside the mpv window. The person who created that issue deleted his videos, so I can't compare to what his problem was, but if you look at his last window the subtitles render the same way, outside the window and on the desktop. Not sure why he didn't comment on it, seems like a big problem to me.

Sat May 15 15:25:23 -04 2021

I have never heard about a compositor before. I take it it's the engine that renders the windows on the OS. Do you have any idea on what I could change here? I've tried these but they make no difference.

@2V3EvG4LMJFdRe 2V3EvG4LMJFdRe changed the title Invisible subtitles on macOS Subtitles render outside the window on macOS May 15, 2021
@2V3EvG4LMJFdRe 2V3EvG4LMJFdRe changed the title Subtitles render outside the window on macOS Subtitles render outside the mpv window on macOS May 15, 2021
@oltodosel
Copy link
Owner

Now that subtitles are rendered properly, you may forget about compositor. It works properly.

Subtitles are rendered independently of mpv's window. And thus they look good only in fullscreen mode, or with maximized window.

@2V3EvG4LMJFdRe
Copy link
Author

Ah! I understand better how the script works now. The preview video on the main page made it seem like they're rendered within mpv.

The problem to me then, is that they don't render on top of mpv. So if I fullscreen or put the window next of the subtitles, they are blocked from view.

Sat May 15 16:26:21 -04 2021

@2V3EvG4LMJFdRe 2V3EvG4LMJFdRe changed the title Subtitles render outside the mpv window on macOS Subtitles render under mpv window on macOS May 15, 2021
@oltodosel
Copy link
Owner

oltodosel commented May 15, 2021

Maybe you've started mpv with --ontop option? Otherwise I've no idea why this happens.

Try changing https://mpv.io/manual/stable/#options-ontop-level

@2V3EvG4LMJFdRe
Copy link
Author

Hmmmm, I have not, it's the default config. I've tried changing to each of those options, but they don't make any difference. Damn, so close to having it work properly! If you don't have any more suggestions, I'll leave the issue open while I tweak things around and see if I manage to fix it.

@oltodosel
Copy link
Owner

Search for Qt.X11BypassWindowManagerHint in the code in replace with Qt.X11BypassWindowManagerHint | Qt.WindowStaysOnTopHint
Might help.

@2V3EvG4LMJFdRe
Copy link
Author

It helped! Now they render on top of the window, but only if it's not fullscreen. Got any more of those lines to fix that? It's something there surely.

For the sake of documentation, the complete line I'm using is Qt.X11BypassWindowManagerHint | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint. If I only add Qt.X11BypassWindowManagerHint | Qt.WindowStaysOnTopHint, the subtitles are rendered like I posted originally, in separate windows.

@oltodosel
Copy link
Owner

Now once again try changing https://mpv.io/manual/stable/#options-ontop-level

@2V3EvG4LMJFdRe
Copy link
Author

I tried all of them again and nothing. Maybe it's just how it is on macOS, wish other people could chime in and say how it goes for them. I'll settle with it as it is, you can close the issue if you'd like. Another thing, is that the subtitles are there no matter if I minimize or unfocus mpv. I tried hide_when_not_fullscreen_B = True makes no difference.

@oltodosel
Copy link
Owner

There's a fork that seems to have been made for Mac. You might try it, or ask with the author about your issue.
https://github.com/ewnd9/intersubs

@2V3EvG4LMJFdRe
Copy link
Author

Just for the record it works the same on that fork.

@oltodosel
Copy link
Owner

Then I'd say the problem is definitely somewhere in your settings.

@2V3EvG4LMJFdRe
Copy link
Author

2V3EvG4LMJFdRe commented May 15, 2021

Maybe his fork isn't meant to address this? I'll try to ask him somehow, seems to have Issues disabled on it. @ewnd9 (maybe this will ping him)

I'm not sure if it's even possible given how the script works. The way macOS handles fullscreen is that you only have that app fullscreen. When you fullscreen an app, there's an animation that moves the whole desktop into the left, and puts the fullscreened app into its own container. You can see it in these screenshots, the second is midst fullscreen animation:

Sat May 15 18:27:10 -04 2021

Sat May 15 18:27:28 -04 2021

Because the script is considered its own app (Python on the dock), its window is moved into the left like all other processes.

I've seen in very rare occasions, apps not being compliant with this type of fullscreen. You can find it because if you alt+cmd (alt+tab) away from it while in fullscreen, this animation isn't triggered. I know Kodi and Wine can do this, but I just tested with a Wine app, and it's the same thing.

Just sharing my findings, I can live with this. Thanks a lot for the script, and I hope not to bother you too much with questions about it in the future.

@2V3EvG4LMJFdRe
Copy link
Author

Fixed at last. Like I said, you have to get it done through that not-compliant fullscreen mode. IINA has it listed in its setting as "Use legacy full screen". Not sure what command it is on mpv.conf.

@adriannedbailo
Copy link

adriannedbailo commented Oct 17, 2023

Fixed at last. Like I said, you have to get it done through that not-compliant fullscreen mode. IINA has it listed in its setting as "Use legacy full screen". Not sure what command it is on mpv.conf.

How do you do this. Can you explain? Because I have the same problem. Are you using IINA instead of mpv if you do tell me please how?

@2V3EvG4LMJFdRe
Copy link
Author

(sorry, quoting doesn't quite work for me)

Yes, you have to use IINA instead of mpv. Just go to the main site, and then, on Preferences it's General > Use legacy full screen.

@adriannedbailo
Copy link

Yeah, thanks I turn it on but have you any ideas how to make mpv scripts working on INNA?

@2V3EvG4LMJFdRe
Copy link
Author

I don't use this script any longer, but I'll try to help. You have to go to .config > (to access .config, in Finder do Go > Go to Folder > ~/.config) here you create the folder "iina" and inside of this the folder "scripts". And you simply add the script there and it should work the same as it does on mpv (sometimes there are bugs though, you have to ask the iina developer on their github about it).

@adriannedbailo
Copy link

Thank you I've fixed it. I used another method: simply added --no-native-fs to the 'mpv.conf' file, and now everything works. However, I have another issue: the script doesn't work without the terminal.

I don't use this script any longer, but I'll try to help. You have to go to .config > (to access .config, in Finder do Go > Go to Folder > ~/.config) here you create the folder "iina" and inside of this the folder "scripts". And you simply add the script there and it should work the same as it does on mpv (sometimes there are bugs though, you have to ask the iina developer on their github about 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

3 participants