Skip to content

fix(subtitle): incorrect Default/Secondary mapping in ASS round-trip - #1164

Open
DriftThe wants to merge 1 commit into
WEIFENG2333:masterfrom
DriftThe:fix-bug-factorymode-asr-revert
Open

fix(subtitle): incorrect Default/Secondary mapping in ASS round-trip#1164
DriftThe wants to merge 1 commit into
WEIFENG2333:masterfrom
DriftThe:fix-bug-factorymode-asr-revert

Conversation

@DriftThe

Copy link
Copy Markdown

The from_ass() method hardcoded Default=original and Secondary=translated, but to_ass() assigns text to these styles depending on the subtitle layout:

  • TRANSLATE_ON_TOP: Default=translated, Secondary=original
  • ORIGINAL_ON_TOP: Default=original, Secondary=translated

This caused text/translated_text to swap when an ASS file was written and read back, effectively reversing the subtitle display order during video synthesis.

Add a "; Layout:" metadata comment to the ASS header in to_ass() so the original layout can be recovered. Update from_ass() to read this metadata and determine the correct Default/Secondary-to-text mapping accordingly. Fall back to ORIGINAL_ON_TOP behavior for legacy ASS files without the metadata.

The from_ass() method hardcoded Default=original and Secondary=translated,
but to_ass() assigns text to these styles depending on the subtitle layout:
- TRANSLATE_ON_TOP: Default=translated, Secondary=original
- ORIGINAL_ON_TOP: Default=original, Secondary=translated

This caused text/translated_text to swap when an ASS file was written and
read back, effectively reversing the subtitle display order during video
synthesis.

Add a "; Layout:" metadata comment to the ASS header in to_ass() so the
original layout can be recovered. Update from_ass() to read this metadata
and determine the correct Default/Secondary-to-text mapping accordingly.
Fall back to ORIGINAL_ON_TOP behavior for legacy ASS files without the
metadata.
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

Successfully merging this pull request may close these issues.

1 participant