I have a subtitle file, it looks like this:00:00:44: Myl, wic jestem.|Kartezjusz, 1596-165000:01:01:Trzynaste Pietro00:01:06:Podobno niewiedza uszczliwia.00:01:10:Po raz pierwszy w yciu|zgadzam si z tym.00:01:13:Wolabym...00:01:15:nigdy nie odkry|tej straszliwej prawdy.00:01:19:Teraz ju wiem...I'm not sure what format this is, but I wanted to convert the subtitles to .srt. Unfortunately gnome-subtitles and subtitleeditor can't recognize this kind of format.gnome-subtitles says:Unable to detect the subtitle format. Please check that the file type  is supported.subtitleeditor says:Please check that the file contains subtitles in a supported format.file output:UTF-8 Unicode textIs there a way to convert this file to .srt format?
How to convert a .txt subtitle file to .srt format?
text processing;perl;conversion;video subtitles
This is very similar to @goldilock's approach but, IMO, simpler and can deal with empty lines in the file and replaces | with a line break :#!/usr/bin/env perlmy ($time, $text, $next_time, $next_text);my ($c,$i)=0;while (<>) {    ## skip bad lines    next unless /^\s*([:\d]+)\s*:(.+)/;    ## If this is the first line. I could have used $. but this is    ## safer in case the file contains an empty line at the beginning.    if ($c == 0) {      $time=$1;       $text=$2;      $c++;    }    else {      ## This is the counter for the subtitle index      $i++;      ## Save the current values      $next_time=$1;       $next_text=$2;           ## I am assuming that the | should be interpreted      ## as a newline, remove this if I'm wrong.      $text=~s/\|/\n/g;           ## Print the previous subttitle      print $i\n$time,100 --> $next_time,000\n$text\n\n;              ## Save the current one for the next line      $time=$next_time; $text=$next_text;    }}     ## Print the last subtitle. It will be dislayed for a minute## 'cause I'm lazy.$i++;$time=~/(\d+:)(\d+)(:\d+)/;my $newtime=$1 . (sprintf %02d, $2+1) . $3;print $i\n$time,100 --> $newtime,000\n$text\n\n;    Save the script as a file and make it executable, then run:./script.pl subfile > good_subs.srtThe output I get on your sample was:100:00:44,100 --> 00:01:01,000 Myl, wic jestem.Kartezjusz, 1596-1650200:01:01,100 --> 00:01:06,000Trzynaste Pietro300:01:06,100 --> 00:01:10,000Podobno niewiedza uszczliwia.400:01:10,100 --> 00:01:13,000Po raz pierwszy w yciuzgadzam si z tym.500:01:13,100 --> 00:01:15,000Wolabym...600:01:15,100 --> 00:01:19,000nigdy nie odkrytej straszliwej prawdy.700:01:19,100 --> 00:02:19,000Teraz ju wiem...