ASCIIPlay
ASCIIPlay copied to clipboard
flickering subtitle box after subtitles finished
I noticed many times when I am playing a video while its subtitle file has ended, I see a flickering white sub box containing the last subtitle.
Steps to reproduce:
- open a video with a subtitle file that ends sooner than the video.
https://github.com/aidancrowther/ASCIIPlay/assets/71609332/a5ef90ad-7de0-439b-b1e6-39eae5088ca6
Interesting, I wonder if the time codes are somehow getting confused. Subtitles and the box they are contained within should only be drawn between specific time windows. Can I see a sample of a subtitle file producing this output? It's possible it is in a non standard format and doesn't have entries where they are expected
This is the subtitle file.
1
00:00:00,010 --> 00:00:02,000
1- edge case
2
00:00:02,010 --> 00:00:04,000
2- quite a long piece of text I expect to get split into two lines as you can see
3
00:00:04,010 --> 00:00:06,000
3- edge
case
4
00:00:06,010 --> 00:00:08,000
4- quite a long piece of text I expect to get split into two lines as you can see
an another piece of very long text that should not even appear as far as I know.
5
00:00:08,010 --> 00:00:10,000
5- line after overflow.
6
00:00:10,010 --> 00:00:12,000
6- generic sub after the last one that overflowed. will it work?
Looking more into this, it seems that when I wrote the subtitle processor I configured it to assume two lines could be read from the art file for every subtitle entry. While this is technically true, since the second line would at worst be a blank line for a single sentence, this is not ideal. Primarily however, I think the issue we are seeing here is in fact related to your subtitle file not matching the art format specification.
The specification states no single line shall exceed 32 characters in length, and when I wrote the allocator to reserve space for subtitles I added some headroom, allowing up to 50 characters. Since your file contains lines exceeding 50 characters, you are exceeding the bounds of memory and possibly causing leakage. I'd start by trying to see if this issue persists with files that meet the srt specification. Following this we can further investigate the issue if it persists.
I will add an issue later to make the subtitle renderer not assume the number of lines of text.