videocr-PaddleOCR icon indicating copy to clipboard operation
videocr-PaddleOCR copied to clipboard

Improve subtitle merge algorithm

Open devmaxxing opened this issue 3 years ago • 8 comments

The algorithm currently merges 2 subtitles by picking the one with the highest average confidence. Ideally, all characters with high confidence should be used if there is no conflict in their positions e.g.

If merging a (99) b (99) c (99) and a (99) b (99) a (98) c (99), the result should be abac instead of abc

devmaxxing avatar Dec 26 '21 00:12 devmaxxing

Is this the reason why the subtitle appears wrong ( flipped and sometimes in the wrong order)?

obaidabit avatar Nov 24 '22 12:11 obaidabit

@obedabit do you have an example?

devmaxxing avatar Nov 24 '22 17:11 devmaxxing

@oliverfei Yes I do, here is an example, I have the following photo it has two line sentences, and the output is wrong on one line, it should be two lines and the last sentence should be the first.

image

output:

3 00:00:51,416 --> 00:00:55,583 right in front of you, of course you'd be depressed. No, if someone else kissed the person you liked

obaidabit avatar Nov 25 '22 12:11 obaidabit

Ah ok. That's cause the library doesn't account the multiline scenario at the moment which is unrelated to this issue.

devmaxxing avatar Nov 25 '22 19:11 devmaxxing

so should we make an issue for It or you will fix it without one?

obaidabit avatar Nov 25 '22 23:11 obaidabit

I pushed something if you want to try it out

devmaxxing avatar Nov 25 '22 23:11 devmaxxing

It is ok, amazing work

obaidabit avatar Nov 27 '22 15:11 obaidabit

The subtitle merging algorithm used by this library is too bad for subtitles that appear as if they were typed rather than appearing in a single frame.

woojh3690 avatar Jul 22 '23 06:07 woojh3690