21

I'm searching for a command line tool that can shift the timing of a subtitle file (*.srt, *.ass).

Ocean
  • 375
  • 3
  • 10
  • Eighteen years ago I had written a perl script to do this on .sub and .srt files. If you are competent in perl you can modify it for .ass files too: https://www.kadifeli.com/fedon/hint.php?perl_stconv – FedKad Sep 08 '20 at 12:30
  • 2
    Ubuntu Software has GUI applications that make shifting the timing of subtitles much easier to do. – karel Sep 08 '20 at 17:16
  • related: https://softwarerecs.stackexchange.com/questions/76096/command-line-subtitle-time-shifter-with-starting-position-linux – Ciro Santilli OurBigBook.com Jan 03 '25 at 11:29

3 Answers3

15

Using ffmpeg this command do the job !

link to the original answer

ffmpeg -itsoffset 2 -i subtitles.srt -c copy subtitles_delayed.srt
ethicnology
  • 289
  • 2
  • 3
7

You can try:

Subsync.

Subsync is a command line tool to syncronize srt subtitles.

You can use it to fix subtitles with both constant and variable time shift.

https://github.com/spion/subsync

Ffsubsync

Language-agnostic automatic synchronization of subtitles with video,

so that subtitles are aligned to the correct starting point within the video.

https://github.com/smacke/ffsubsync

kyodake
  • 18,075
2

You can try srt-stf (srt subtitles time fixer):

A simple tool written in Python: netharuM / srt-subtitle-time-fix

srt-stf --file <input_track>.srt --time 00:00:28,500 -o <output>.srt

This command will slow the subtitle by 28.5 seconds. And if you want the subtitles to appear sooner simply add the '-n' flag

srt-stf --file <input_track>.srt --time 00:00:28,500 -n -o <output>.srt
Greenonline
  • 2,182