libass / libass

libass is a portable subtitle renderer for the ASS/SSA (Advanced Substation Alpha/Substation Alpha) subtitle format.
ISC License
935 stars 217 forks source link

Support v4++ #461

Open rcombs opened 3 years ago

rcombs commented 3 years ago

This exists in xy-vs and it's unclear why we don't handle it… but I'm not entirely sure how it's used. Corresponding xy-vs code: https://github.com/Cyberbeing/xy-VSFilter/blob/ff77719517bc0c1144a75c7b2c1e6268d582614a/src/subtitles/RTS.cpp#L2509-L2517

astiob commented 3 years ago

It’s part of ASS2 (SSA4++), which we don’t currently support any of. Neither does Aegisub, although, of course, it renders \kt when VSFilter is selected.

astiob commented 3 years ago

As for its use, it lets you specify when a karaoke syllable starts as an absolute time (during the event’s duration) instead of as an implicit sum of all preceding karaoke tags.

TheOneric commented 2 years ago

If I didn't miss something our prior discussions and findings about v4++ aren't summarised anywhere on the issue tracker yet; let's use this issue for v4++ as a whole.

All new features are:

Since libass parses Format lines (and non-standard lines affect the defaults), we need to know the canonical field names. The internal names of VSF do not always match the in-document names. VSFilter itself only creates v4 and v4+ but no v4++ files, thus not contributing any hint. Also while Aegisub for a while supported read/write of v4++ files, it never wrote Format: lines for v4++ files.

TheOneric commented 2 years ago

Regarding relativeTo (originally intended) purpose and the Format: field names, here's an excerpt from asa’s wiki (see: https://web.archive.org/web/20071018035454/http://asa.diac24.net/ASS2 ):

ASS2 is a minor extension to the ASS subtitle format. It was introduced in VSFilter SVN revision 453 (November 2005), but did not become public until being noticed in MPC somewhen around March 2006 (cf. http://forum.doom9.org/showthread.php?t=108356)

The changes are:

  • occurrences of MarginV are replaced by MarginT,MarginB thereby allowing different top/bottom margins
  • an additional field (RelativeTo) is introduced on Style: lines after the Encoding field. Its values/meanings are:
    • zero: use video display as coordinate base, including potential black bands around the frame
    • nonzero: keep traditional/standard behaviour (frame-relative coordinates)

ASS renderers and editing tools are unlikely to correctly process ASS2 files.

Though asa, just like VSFilter, itself, did not parse Format: lines in the last source snapshot I could aquire, it’s wiki page about AS5 (a joint draft future version by asa and Aegisub devs, which never came to fruition) contains an example AS5 Format: line which also uses the RelativeTo, MarginB and MarginT names.

Given that VSFilter and Aegisub also don't/didn't read or create Format: lines for ASS2, using those names as the canonical ones in our implementation should be good enough and safe.

TheOneric commented 10 months ago

It appears the linked excerpt from asa’s wiki didn’t get the numeric values for relativeTo right. Acccording to https://github.com/libass/libass/pull/649#issuecomment-1264426724 the values are: