Skip to content

Feature/subtitle alignment#85

Open
quentin954 wants to merge 6 commits intotimminator:masterfrom
quentin954:feature/subtitle-alignment
Open

Feature/subtitle alignment#85
quentin954 wants to merge 6 commits intotimminator:masterfrom
quentin954:feature/subtitle-alignment

Conversation

@quentin954
Copy link

Hello,

I propose this PR so that users who want to keep the original spatial layout of their subtitles especially when working with multiple zones can do so easily and reliably.

Currently, the SRT files generated do not keep any information about where subtitles were originally positioned on screen. This becomes an issue when using dual zone mode to extract subtitles from two different areas at the same time for example dialogues at the bottom and comments at the top.

To solve this, i added the option to automatically insert ASS positioning tags {\anX} into the exported subtitles. Users can now set the alignment for each zone separately, like bottom-center for dialogues and top-center for comments and this information stays in the SRT file. Compatible players like VLC or MPV will then display each subtitle in its correct position.

The feature is disabled by default, so existing workflows are not affected. It simply offers a clean and standard way to preserve subtitle positioning for users who need it.

Copy link
Owner

@timminator timminator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Sorry for the late answer. Very interesting idea. I did not know that srt files (or better players reading it) support subtitle position tags from ASS subs.
I noticed a few things though.

  1. The checkbox and the alignment combo boxes are currently hardcoded in English and aren't hooked into the localization system. Please add the new keys to the key_map dictionary inside the update_gui_text function in VideOCR.py and add the corresponding translation strings to the language files so they are available in all suported languages.

  2. The logic you added to gray out the alignment dropdowns when the feature is disabled works when clicking the checkboxes but at startup it doesn't set the correct disabled/enabled state based on the saved configuration. The update_alignment_controls function needs to be alo called at the end of the load_settings function I think to fix this.

  3. The biggest problem is that in your PR the tags are being injected after the text from Zone 1 and Zone 2 has already been merged into a single block. The zone attribute is not preserved. I think the dual zone merging logic needs to be bypassed when the alignment feature is enabled (in the _generate_subtitles function I would do this I think). Then we would write one sub for each zone with a position tag to the srt file if subtitle alignment is enabled instead of merging them. Here we could also check if the position for Zone 1 and Zone 2 is identical and in that special case merge them anyway? Just something I noticed right now.

quentin954 added 4 commits February 28, 2026 01:12
a feature to control the subtitle alignment for both Zone 1 and Zone 2

this adds the ability for users to specify the exact position of subtitles within the cropped zones (e.g., bottom-center, top-left)
@quentin954 quentin954 force-pushed the feature/subtitle-alignment branch from 4f1dac6 to f3c3dc4 Compare February 28, 2026 00:12
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.

2 participants