fix(subtitle): incorrect Default/Secondary mapping in ASS round-trip - #1164
Open
DriftThe wants to merge 1 commit into
Open
fix(subtitle): incorrect Default/Secondary mapping in ASS round-trip#1164DriftThe wants to merge 1 commit into
DriftThe wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The from_ass() method hardcoded Default=original and Secondary=translated, but to_ass() assigns text to these styles depending on the subtitle layout:
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.