ripose-jp / Memento

An mpv-based video player for studying Japanese
https://ripose-jp.github.io/Memento/
GNU General Public License v2.0
490 stars 21 forks source link

Maintain subtitle style with .ass subtitles #45

Open ElaxDev opened 3 years ago

ElaxDev commented 3 years ago

I wish there was an option of maintaining the style of .ass subtitles instead of the player overriding it, there are color-coded subtitles that look so beautiful but that is lost when using the player's subtitles instead of mpv's ones.

Memento's subtitles: image

MPV's subtitles: image

Calvin-Xu commented 3 years ago

My understanding is that Memento draws its own subtitles from scratch with the values from mpv's sub-text property. It's not overriding anything and not very coupled with mpv at all.

mpv does also provide a sub-text-ass property, but per documentation it is not enough to render ASS subtitles from it because the header and other metadata are not included. I think at the very least this requires Memento to do its own parsing of subtitle files (possibly also need to extract embedded subs, related to https://github.com/ripose-jp/Memento/issues/29). It would then be a huge task to reimplement rendering ASS subtitles in Qt, as I don't think there are renderers that support querying the text content. For now, I think it's probably best to hide Memento's subtitle widget during playback and only show mpv's, and vice versa.

ripose-jp commented 3 years ago

Everything Calvin said is correct, but I'd also like to give some input.

Pretty much the only ass renderers that I know of are libass and JavascriptSubtitlesOctopus. From my understanding, both of these libraries take in ass formatted subtitles, render them, and then output a raster. For hover subtitles to work, I need to somehow map a cursor position to a character. That's not easy because libass only outputs a raster without telling me what characters are at what locations in the raster. To fix this, I'd have to fork libass and modify it to retain this information. This is probably hundreds of hours of work and I don't think the cost benefit works out to well.

The best compromise I can come up with is adding an option to make the subtitle styling use the font, color, stroke, stroke color, and maybe size as defined by whatever ass subtitles are being used. This would probably be pretty easy since I have to write an ass parser anyway to deal with #29. Still this wouldn't get anywhere near allowing Memento to display subtitles as expressive as ass can get. For example, the way the stroke is translated slightly to the bottom right for that shadow effect in your example image wouldn't be possible without some nasty hacks.

I think the best option is to just use the subtitles mpv renders by going into Settings → Options → Search, unchecking "Hide mpv subtitles when search bar is visible", and checking "Hide search bar while playing media".

Still, I'm going to leave this open in case someone crazy wants to try something.

Calvin-Xu commented 3 years ago

I want to add that the majority of original Japanese subtitles are found in plain srt. ASS subtitles with additional markup are primarily used by fansub groups, of which there are some that transcribe Japanese dialogue by listening (such as Kamigami) but generally they are of inferior quality to the original/official release.

eyalmazuz commented 1 month ago

I want to add that the majority of original Japanese subtitles are found in plain srt. ASS subtitles with additional markup are primarily used by fansub groups, of which there are some that transcribe Japanese dialogue by listening (such as Kamigami) but generally they are of inferior quality to the original/official release.

I know it's a fairly old issue but re-reading it after fixing some ass issues in a different software

I would say that most raws today come both with ASS and SRT on default (group such as Koi-Raws, NanakoRaws, NewRaws [only those that are marked as NF files]) most of the groups I use to get my raw anime, have the subtitles embedded already in the episode and they provide both ASS and SRT

it's true that in this case that both are provided I can just switch to SRT but ASS useless color coding is nice, and sometimes they have furigana for words

so I think there's some benefit for having ASS files displayed correctly

example of embedded furigana in the ASS file from a last season anime shoushimin series: mpv-shot0001

how it's currently displayed in memento: image