TG Telegram Group & Channel
GeekTips | United States America (US)
Create: Update:

awk script to run to detect any stuck subtitles

for f in *.vtt *.srt ; do printf "%s\n" "$f" ; awk -F ":" '/[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3} -->/ {if ($2>$4 || $2<$4-1 ) print "        Line# "NR": " $1":"$2" "$4 }' "$f" | awk '!/59 00/' ; done

It'll print Line # with any duration more than 2 mins or if the last minute mark is less than the first minute mark.

audiobook17.vtt
Line# 19040: 04:09 56
Line# 22400: 04:56 10
Line# 82120: 18:27 29
Line# 82256: 18:29 27

first line the subs will stay on screen from 4h 9min until 4h 56m so the two 56 min marks need to be replaced with either 9 or 10..lemme check ok to a 10

4760
04:09:56.940 --> 04:56:39.090

He had returned to the Berghof, high above the little alpine town of Berchtesgaden,

4761
04:10:02.160 --> 04:10:09.170
on February 6, 1938. It was here that he always came when he had to ponder

So this will fix it
4760
04:09:56.940 --> 04:10:02.160

He had returned to the Berghof, high above the little alpine town of Berchtesgaden,

4761
04:10:02.160 --> 04:10:09.170
on February 6, 1938. It was here that he always came when he had to ponder

notice the modified end time is same as next start time 04:10:02.160 -->

awk script to run to detect any stuck subtitles

for f in *.vtt *.srt ; do printf "%s\n" "$f" ; awk -F ":" '/[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3} -->/ {if ($2>$4 || $2<$4-1 ) print "        Line# "NR": " $1":"$2" "$4 }' "$f" | awk '!/59 00/' ; done

It'll print Line # with any duration more than 2 mins or if the last minute mark is less than the first minute mark.

audiobook17.vtt
Line# 19040: 04:09 56
Line# 22400: 04:56 10
Line# 82120: 18:27 29
Line# 82256: 18:29 27

first line the subs will stay on screen from 4h 9min until 4h 56m so the two 56 min marks need to be replaced with either 9 or 10..lemme check ok to a 10

4760
04:09:56.940 --> 04:56:39.090

He had returned to the Berghof, high above the little alpine town of Berchtesgaden,

4761
04:10:02.160 --> 04:10:09.170
on February 6, 1938. It was here that he always came when he had to ponder

So this will fix it
4760
04:09:56.940 --> 04:10:02.160

He had returned to the Berghof, high above the little alpine town of Berchtesgaden,

4761
04:10:02.160 --> 04:10:09.170
on February 6, 1938. It was here that he always came when he had to ponder

notice the modified end time is same as next start time 04:10:02.160 -->


>>Click here to continue<<

GeekTips




Share with your best friend
VIEW MORE

United States America Popular Telegram Group (US)