VodBox / txt2sub.js

Text to Captions/Subtitle Conversion Library
5 stars 0 forks source link

Bugs: timecode math, webapp options? #1

Open robbyblum opened 4 years ago

robbyblum commented 4 years ago

I have found a couple bugs in the code, or at least the code being used by the webapp (which I am guessing is also the most recent code on the master branch?). Attached is the txt file I put into it, and two output files, one where I checked the "Split Only On Blank Lines" option and one where I did not. In both cases, I set the video length to be 10:00.

txt2subtest.zip

So, bugs:

1. Overlapping and zero-length timecodes: None of the timecodes use fractions of seconds, and many of them are zero seconds long:

1 00:00:00,000 --> 00:00:00,000 Bee Movie Script - Dialogue Transcript

2 00:00:00,000 --> 00:00:00,000

According to all known laws of aviation,

3 00:00:00,000 --> 00:00:01,000

there is no way a bee should be able to fly.

4 00:00:01,000 --> 00:00:01,000

Its wings are too small to get its fat little body off the ground.

5 00:00:01,000 --> 00:00:02,000

The bee, of course, flies anyway

6 00:00:02,000 --> 00:00:02,000

because bees don't care what humans think is impossible.

My guess is that the calculation of timeDelta on L46 is doing integer division, which always rounds down. Since we have access to milliseconds, we should probably use them if we need to. Since the default video length is apparently 60 seconds, this will likely be an issue when using that as well.

2. "Split Only On Blank Lines" in webapp doesn't do anything: The above quote is from unchecked.srt, where I did not check the box. The below is from checked.srt, where I checked the box. They seem to be the same, which I am pretty sure isn't intended! Also, don't worry about the blank lines between timecodes and text; my version of the Bee Movie script (attached as the input file) has a line consisting solely of two spaces above each actual line for some weird reason.

1 00:00:00,000 --> 00:00:00,000 Bee Movie Script - Dialogue Transcript

2 00:00:00,000 --> 00:00:00,000

According to all known laws of aviation,

3 00:00:00,000 --> 00:00:01,000

there is no way a bee should be able to fly.

4 00:00:01,000 --> 00:00:01,000

Its wings are too small to get its fat little body off the ground.

5 00:00:01,000 --> 00:00:02,000

The bee, of course, flies anyway

6 00:00:02,000 --> 00:00:02,000

because bees don't care what humans think is impossible.

(The first bug probably didn't show up in your video demonstration because it looks like you didn't paste the entire Bee Movie script into the webapp. Shows the benefit of truly rigorous testing ;) )

VodBox commented 4 years ago

Both issues have been fixed in the library and web app respectively. If everything now works as expected, please let me know and feel free to close the issue.

VodBox commented 4 years ago

Hey, have you been able to confirm that the web app now works correctly?