-
Notifications
You must be signed in to change notification settings - Fork 3k
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
RTL display for subtitles #12978
Comments
diff --git a/sub/sd_ass.c b/sub/sd_ass.c
index 6742f6f658..1b139b1a06 100644
--- a/sub/sd_ass.c
+++ b/sub/sd_ass.c
@@ -448,8 +448,10 @@ static void configure_ass(struct sd *sd, struct mp_osd_res *dim,
ass_set_hinting(priv, set_hinting);
ass_set_line_spacing(priv, set_line_spacing);
#if LIBASS_VERSION >= 0x01600010
- if (converted)
+ if (converted) {
ass_track_set_feature(track, ASS_FEATURE_WRAP_UNICODE, 1);
+ ass_track_set_feature(track, ASS_FEATURE_WHOLE_TEXT_LAYOUT, 1);
+ }
#endif
if (converted) {
bool override_playres = true; Can you try this diff? Or alternatively provide sample subtitles, if it works then hooking it up to an option should be trivial |
url doesn't work for me, can you just upload the file to github? |
GitHub does not allow uploading
Here it is in a |
@llyyr Thanks for this quick fix! very appreciate :) The word " Or just html with Same thing for example at position The word " I checked and the problem also exists when using a single subtitle track. This is the command I used:
I am also attaching the LTR subtitles, in case you need them: |
Now I'm thinking, maybe the correction only helped in cases where the first letter in the current sentence is in Hebrew and the English word is in the center of the sentence, but if the first word in the sentence is in English, the entire sentence is defined as LTR? |
For reference, this subs file is auto translation of youtube to Hebrew. Is there any player which shows this correctly? As far as I can tell, both MPC and VLC also show it broken like this. Even in Firefox at the youtube page it shows it the same (broken). As far as I can tell it only shows correctly in chrome (based) browsers. Maybe chrome does some magic where it knows to show it RTL primarily, which bypass the brokenness of the subs? |
Kodi displays it correctly but violates specifications while doing so xbmc/xbmc@d807316 edit: The original webvtt generated by youtube itself doesn't contain any RTL markings, so it's not really possible to auto-detect this information. I'd consider these subtitles to be broken, but there's still some merit for libass to provide some API for forcing RTL rendering |
As far as I can tell, this patch replaces LTR/RTL marks encoded as HTML literals However, neither the SRT nor the original VTT from which it was converted have any RTL marks (HTML/direct/embedded), so basically whoever renders it simply can't know that it's primarily RTL. TL;DR: these subs are broken. The reason chrome renders it correctly is because it has a CSS tag which overrides to RTL, but that info is not conveyed at the vtt/srt files. libass (via fribidi) can guess most of the lines correct, according to the first word of the line, but this would only work for lines which begin in Hebrew (and this vtt/srt also has lines which should be RTL but begin in English - so that would be broken anyway with auto detection). However 2, libass doesn't enable autodetection in fribidi by default, for compatibility with vsfilter. To enable autodetection (which would still be broken with lines which begin in English), we'd need #12985 . To allow the user to force RTL primarily for all the lines (in fribidi, instead of autodetect), libass will need to add some support which currently doesn't exist. However, the first and bottom lines are that the subs are broken. The RTL info is conveyed at a side channel of the browser, and it's not part of the subs themselves. Any auto detection, or force options, would be ugly workarounds for broken subs. |
I think automatic detection based on paragraph initiation is common behavior. This is actually the default for browsers, meaning that when RTL/LTR is not explicitly set it will be auto |
Any updates on this issue please? |
Before requesting a new feature make sure it hasn't been requested yet.
meta:feature-request
Expected behavior of the wanted feature
Option to display subtitles with RTL (right to left) correct.
Either automatic (detection of the subtitle language) or a command line option.
This is consumed for translated subtitles, that the translation always leaves certain words in English, and then those words escape to the right side of the display.
It was created here following this problem that I opened in IINA that uses mpv behind the scenes: iina/iina#4698
Log file
I'm using iina which uses mpv behind the scenes so I have no idea how to get a log file.
The text was updated successfully, but these errors were encountered: