I am using FFMPEG to convert VTT file to SRT. But the output file has overlapping issue. I need help to fix this overlapping issue

WEBVTT Kind: captions Language: en Style: ::cue(c.colorCCCCCC) { color: rgb(204,204,204); } ::cue(c.colorE5E5E5) { color: rgb(229,229,229); } ## 00:00:06.160 --> 00:00:17.410 align:start position:19% a<c.colorE5E5E5><00:00:08.280><c> kung</c><00:00:09.280><c> fu</c><00:00:09.309><c> master</c><00:00:11.340><c> he's</c><00:00:12.340><c> prepared</c></c><c.colorCCCCCC><00:00:12.940><c> to</c><00:00:13.180><c> train</c></c> 00:00:13.540 --> 00:00:28.230 align:start position:19% hard<c.colorE5E5E5><00:00:15.600><c> move</c><00:00:16.600><c> fast</c></c> 00:00:17.410 --> 00:00:31.710 align:start position:19% <c.colorCCCCCC>incoming</c><c.colorE5E5E5><00:00:18.400><c> be</c><00:00:18.910><c> brave</c><00:00:22.770><c> and</c><00:00:23.770><c> above</c><00:00:24.280><c> all</c></c><c.colorCCCCCC><00:00:26.730><c> be</c><00:00:27.730><c> ready</c></c> 00:00:28.230 --> 00:00:31.710 align:start position:19% for<00:00:29.230><c> anything</c> 00:00:35.370 --> 00:00:47.829 align:start position:19% perfect<c.colorE5E5E5><00:00:36.390><c> really</c></c><c.colorCCCCCC><00:00:37.390><c> know</c><00:00:38.249><c> again</c><00:00:40.739><c> but</c><00:00:41.739><c> next</c></c> 00:00:42.069 --> 00:00:50.969 align:start position:19% January<c.colorE5E5E5><00:00:42.789><c> nothing</c><00:00:43.569><c> can</c><00:00:43.809><c> prepare</c><00:00:43.989><c> him</c><00:00:44.229><c> for</c><00:00:46.829><c> his</c></c> 00:00:47.829 --> 00:00:50.969 align:start position:19% greatest<00:00:48.219><c> challenge</c><c.colorCCCCCC><00:00:48.519><c> yet</c></c> 00:00:52.720 --> 00:01:00.140 align:start position:19% who<00:00:53.720><c> are</c><00:00:54.350><c> you</c><00:00:55.390><c> I'm</c><00:00:56.390><c> Li</c><00:00:56.900><c> Shan</c><c.colorE5E5E5><00:00:57.610><c> I'm</c><00:00:58.610><c> looking</c><00:00:59.300><c> for</c></c> 00:00:59.570 --> 00:01:08.840 align:start position:19% my<00:00:59.780><c> son</c> 00:01:00.140 --> 00:01:13.300 align:start position:19% <c.colorCCCCCC>oh</c><c.colorE5E5E5><00:01:03.610><c> you</c><00:01:04.610><c> lost</c><00:01:04.820><c> your</c><00:01:05.030><c> son</c><00:01:05.330><c> yes</c><00:01:06.640><c> many</c><00:01:07.640><c> years</c><00:01:08.570><c> ago</c></c> 00:01:08.840 --> 00:01:20.330 align:start position:19% <c.colorE5E5E5>I<00:01:09.430><c> lost</c><00:01:10.430><c> my</c><00:01:10.550><c> father</c><00:01:11.170><c> I'm</c></c><c.colorCCCCCC><00:01:12.170><c> very</c><00:01:12.500><c> sorry</c></c> 00:01:13.300 --> 00:01:25.190 align:start position:19% thank<00:01:14.300><c> you</c><00:01:17.110><c> well</c><00:01:18.729><c> good</c><00:01:19.729><c> luck</c><c.colorE5E5E5><00:01:19.760><c> to</c><00:01:20.030><c> you</c></c> 00:01:20.330 --> 00:01:28.720 align:start position:19% <c.colorE5E5E5>you<00:01:21.320><c> too</c></c><c.colorCCCCCC><00:01:21.560><c> I</c><00:01:21.850><c> hope</c><00:01:22.850><c> you</c><00:01:22.970><c> find</c><00:01:23.150><c> your</c><00:01:23.270><c> son</c><00:01:23.390><c> and</c><00:01:24.190><c> I</c></c> 00:01:25.190 --> 00:01:28.720 align:start position:19% hope<00:01:25.490><c> you</c><00:01:25.729><c> find</c><00:01:26.119><c> your</c><c.colorCCCCCC><00:01:26.300><c> father</c></c> 00:01:50.619 --> 00:01:52.679 align:start position:19% <c.colorE5E5E5>you</c> 

Converted SRT file

1 00:00:06,160 --> 00:00:17,410 a kung fu master he's prepared to train 2 00:00:13,540 --> 00:00:28,230 hard move fast 3 00:00:17,410 --> 00:00:31,710 incoming be brave and above all be ready 4 00:00:28,230 --> 00:00:31,710 for anything 5 00:00:35,370 --> 00:00:47,829 perfect really know again but next 6 00:00:42,069 --> 00:00:50,969 January nothing can prepare him for his 7 00:00:47,829 --> 00:00:50,969 greatest challenge yet 8 00:00:52,720 --> 00:01:00,140 who are you I'm Li Shan I'm looking for 9 00:00:59,570 --> 00:01:08,840 my son 10 00:01:00,140 --> 00:01:13,300 oh you lost your son yes many years ago 11 00:01:08,840 --> 00:01:20,330 I lost my father I'm very sorry 12 00:01:13,300 --> 00:01:25,190 thank you well good luck to you 13 00:01:20,330 --> 00:01:28,720 you too I hope you find your son and I 14 00:01:25,190 --> 00:01:28,720 hope you find your father 15 00:01:50,619 --> 00:01:52,679 you 

see the overlaping here

4

1 Answer

UPDATE!

ffmpeg can do it at convert time with -fix_sub_duration option.

from man ffmpeg:

 -fix_sub_duration Fix subtitles durations. For each subtitle, wait for the next packet in the same stream and adjust the duration of the first to avoid overlap. This is necessary with some subtitles codecs, especially DVB subtitles, because the duration in the original packet is only a rough estimate and the end is actually marked by an empty subtitle frame. Failing to use this option when necessary can result in exaggerated durations or muxing failures due to non- monotonic timestamps. Note that this option will delay the output of all data until the next subtitle packet is decoded: it may increase memory consumption and latency a lot. 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy