-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Suggestion] show-text command could need position argument #4847
Comments
Will display You can also omit the You can also use colors, font sizes, etc. See more at https://github.com/libass/libass/wiki/ASSv5-Override-Tags and http://docs.aegisub.org/3.2/ASS_Tags/ . I think that your |
This depends on how you use it. If you use it at If you use it from a natively loaded script (lua or js), then you need Alternatively, if you use However, you can expand the properties yourself with the So you'll have to experiment with different approaches. My suggestion is to first try it at |
I see :) Thanks for the info about properties expansion. I'll look into it as you said, and see how the framework I use works. For info it's node-mpv : I suppose the issue can be closed now, I should be able to position my text as I see fit with this information. Thank you. |
Hmm.. if you use it externally it could be difficult, since the value which is the expanded I'd suggest to write your own mpv-lua script to be used as a proxy (listens to script-message) which accepts the string and then uses it like I mentioned above. And from your own script you'll send a command like maybe |
@avih In my understanding, The only event I can see that would be triggered by external IPC command is I tried it via When I send this via IPC :
it sends the string parameter of The expected behaviour, to me, would be that I'll reopen the issue since in my opinion, being able to send text with parameter expansion like I'd need to display ASS should be simpler and work via IPC.. |
I meant do something like this:
mp.register_script_message("command-str", function(s)
mp.command(s) -- this can do property expansion on s
end)
Or, alternatively, if you want to send it only to this script (doesn't matter much though, unless you have other scripts which register
As for expanding text variables, you should read the manual and libmpv headres - not all invocations do property expansion automatically. But you can still do explicit property expansion via the
which will return the expanded string. You could do the expansion for I'm not entirely sure whether or not the IPC mechanism on its own can be used to show unescaped ASS - @wm4 might know more, however, mpv supports scripting too, and with the script proxy above you can execute IPC command which will get property-expansion like it would at |
I confirm this does work indeed. I still need to figure out how to use it with node-mpv, because at this moment it won't load the script I prepared with your help. Thanks a lot for the info, it's very valuable and interesting, now I understand better how the scripting works in mpv. I still wish there would be a simpler way than making a IPC proxy via a script though. |
There's a
|
Huh, apparently it's much simpler than the above, without requiring a proxy script:
I actually tried the Shall we close the issue? |
Oh yes, I confirm this works. I cannot send ASS commands through my own app, but it works if I hardcode the ASS commands in the code for now and leave the message itself to my API. Looks like I'll be able to live with that. I'll be trying a few things first and will close the issue a bit later, if that's okay. Just to make sure this does what I wish it does. :) Thanks for your immense help @avih ! |
Okay, made it work flawlessly after I figured out how to use all ASS features or almost. The libass documentation looks a bit unclear, but the aegisub one is much simpler. It fits my needs as is, I can display stylized text in the corner of the screen during the first 8 seconds of playback, for example : These are variables in a database, so it works as I originally intended it to :) Here's an example ASS string for it in JS :
My only "complaint" would be that you can't send two show-text commands one after the other, the second one cancels the first one, even if the text displayed on screen is different or positioned elsewhere, but I guess I'm being greedy now, aren't I? :) This issue can be closed unless someone wants to follow-up on the show-text commands canceling each other? |
pfff... all this for persona 5? good thing (for you) you didn't say it earlier ;) So, good to close? :) |
Haha :) Yes, will close it now, thank you again for your invaluable help. |
mpv version and platform : latest stable / Windows
EDIT : Changed the title of the issue since this is not about positioning text via show-text anymore but is more about parameter expansion via the IPC protocol. As I understand it (and tried it) parameter expansion only works with LUA/JS scripting inside mpv or with
input.conf
file, but not through the IPC server mpv provides, which is used for instance by my app to display text above a video rendered via mpv. Parameter expansion should work via IPC as well.I'm making an app using mpv to play out videos, and toyed around with the show-text command. While it's neat, positionning it on the screen could be interesting. For instance my app is for karaoke playback, so displaying messages via show-text actually overlaps with the lyrics displayed on top of the screen.
By default text is displayed in the top left corner of the screen.
I tried to change the vertical position by adding several \n in the text I send to mpv, but they didn't get caught by mpv and the text stayed in the top left corner.
One suggestion I'd make would be to add a valign and halign parameters to show-text, where you could specify left/right/center and top/bottom/center
Thanks for reading this, I hope this isn't too much of a silly feature request :)
The text was updated successfully, but these errors were encountered: