Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8686743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:56:27+00:00 2026-06-12T22:56:27+00:00

How to correct/shift subtitle time forward and backward? Subtitle time format looks like this:

  • 0

How to correct/shift subtitle time forward and backward? Subtitle time format looks like this:
00:00:52,656 --> 00:00:56,326

If subtitle and audio aren’t synchronized, for example, subtitle shows up before voice/audio, then all times of subtitle lines (time format: 00:00:52,656 --> 00:00:56,326) should be corrected.

So, if time of all subtitle lines must be changed/shifted for 2 sec. forward, then, this time for subtitle line: 00:00:52,656 --> 00:00:56,326 should be changed to:
00:00:54,656 --> 00:00:58,326.

And this refers to all times in the subtitle file, not just one line of text/one time.


Example of how SubRip (.srt) file looks like:

1
00:00:52,656 --> 00:00:56,326
Kanalska Zona: Panama

2
00:00:56,335 --> 00:00:59,755
Francuzi su pokušali da izgrade
kanal pre Amerikanaca.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:56:29+00:00Added an answer on June 12, 2026 at 10:56 pm

    Providing that the format of each line in your input is always 00:00:00,000 --> 00:00:00,000, then this routine will convert the string times to TDateTime, add or subtract the shift, and rewrite the line:

    procedure ShiftSubtitleTimes(Lines: TStrings; Diff: TTime);
    var
      FS: TFormatSettings;
      I: Integer;
      T1: TDateTime;
      T2: TDateTime;
    begin
      // Ensure using the correct time separator
      FS.TimeSeparator := ':';
      // Parse each line separately
      for I := 0 to Lines.Count - 1 do
      begin
        // Convert the two time strings to time values
        if not TryStrToTime(Copy(Lines[I], 1, 8), T1, FS) then
          // But skip line in case of wrong format
          Continue;
        T1 := T1 + StrToInt(Copy(Lines[I], 10, 3)) / MSecsPerDay;
        T2 := StrToTime(Copy(Lines[I], 18, 8), FS);
        T2 := T2 + StrToInt(Copy(Lines[I], 27, 3)) / MSecsPerDay;
        // Add the shift
        T1 := T1 + Diff;
        T2 := T2 + Diff;
        // Rewrite the line
        Lines[I] := FormatDateTime('hh:nn:ss,zzz --> ', T1, FS) +
          FormatDateTime('hh:nn:ss,zzz', T2, FS);
      end;
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      List: TStringList;
    begin
      List := TStringList.Create;
      try
        List.LoadFromFile('Filename.dat');
        Memo1.Lines.Add('Input:');
        Memo1.Lines.AddStrings(List);
        Memo1.Lines.Add('');
        // Shift 3,5 seconds backwards:
        ShiftSubtitleTimes(List, -3.5 / SecsPerDay);  
        Memo1.Lines.Add('Output:');
        Memo1.Lines.AddStrings(List);
      finally
        List.Free;
      end;
    end;
    

    enter image description here

    Edit:

    Due to your edit, now input may contain ‘wrong’ lines that need no conversion too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to phase shift audio in real time on the iPhone? I
Is this usage of unpack correct if I would like to try this guessing
How would you correct way to handle an exception in this situation? Initially I
Is it correct that reset requires shift inside the block? I tried it and
Right, sorry I can't think of the correct words to google this. So I'll
I would like to know if performing a logical right shift is faster when
Correct me If I am doing wrong, I have just started to check WCF
Correct me if anything is wrong. Now when we use Spring DAO for ORM
correct me if im wrong, but isn't distributed SCMs for OS projects while centralized
Correct me If Im wrong. public class Person{ List<Cars> myCars; //Get and Set }

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.