Independent of the media player, I want to display separate subtitles in a scrolling text terminal to make language learning easier, or when I want more/different subtitles than the other viewers, basically a standalone subtitle player.

The subtitle format I am seeking to display is srt, an easy text-based format:

<indexNr>                    # Starts at 1, then 2, 3, ...
<startTime> --> <endtime>    # Both times in format "hh:mm:ss,ms"
<body1>                      # Subtitle text Line
<bodyN>                      # Optional following lines
<emptyLine>                  # Empty line as separator


00:00:02,623 --> 00:00:05,054
U&L StackExchange Studios present
♫ Nice Tune playing ♫

00:00:06,823 --> 00:00:08,414
From the <b>A Quick Hack</b> series

00:00:10,123 --> 00:00:23,054
Viewing Srt Files with Perl:

~/bin/playSRT.sh: (What I currently do)

perl -lane 'BEGIN{$counter=1;}
if(@F[1]=~ /-->/) {
  $s=@t[0]*3600+@t[1]*60+@t[2] ;
  #print "Waiting until $s s @t[0] @t[1] @t[2]";
  sleep($s-$last); $last=$s;
} else {if (@F[0] == $counter) {$counter++} else {print }}
' "$1"

I then run playSRT.sh MyFile.srt, and that works sufficiently well, but has short-comings, like awkward pause/resume, and impossible RW/FF.

I am looking for a better solution. I googled, and I have no suitable programs in my package manager. At this point -i think- my best option is optimizing/fleshing out the above to read keyboard input for play/pause, +/-5 secs. I am looking for help with that and/or new directions in the quest "2 subtitles in small splits at the bottom".

  • What do you mean by _awkward pause resume? _ How would you like it to behave instead.? – Stéphane Chazelas May 26 '17 at 5:14

Your Answer

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

Browse other questions tagged or ask your own question.