6

I have subtitles that are already coded into a video, but which are delayed by 700ms.

I have about 50 episodes of a show and it's getting annoying to have to set the subtitle delay in VLC everytime I want to watch it.

How can I fix these videos?

slhck
  • 223,558
  • 70
  • 607
  • 592
user168459
  • 69
  • 1
  • 1
  • 2
  • 1
    If the subtitles are already *in* the video stream, as opposed to coming from an external ST file, you're out of luck. –  Oct 28 '12 at 19:28
  • 4
    It would help to clarify if the subtitles are hardcoded, multiplexed in the video file (MKV or MP4, etc.), or if they're in a separate `.srt` file. Also, have you tried a subtitle editor already? – slhck Oct 28 '12 at 19:31
  • See this VLC [article](https://wiki.videolan.org/VLC_HowTo/Adjust_subtitle_delay/) about subtitle delaying. – Biswapriyo Aug 20 '17 at 03:40

2 Answers2

17

Only a few years late but:

This works for non-hardcoded (non-burned) subs, so embedded srt, ass, and the like.

ffmpeg -i input.mp4 -itsoffset -0.7 -i input.mp4 -map 0:v -map 0:a -map 1:s -c copy output.mp4

This command uses the same file for input twice, but using -itsoffset -0.7 tells it to offset the timestamps on the following input by -0.7 seconds. The map commands then tell it to grab the video and audio from the 0th input that doesn't have a delay, and grab the subtitle track from the 1st input which is offset.

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
odie5533
  • 271
  • 2
  • 2
  • 1
    This also works for just adjusting an SRT file, in and out. – jtgd Nov 25 '17 at 11:06
  • 5
    @jtgd indeed `ffmpeg -itsoffset 0.7 -i original.vtt adjusted.srt` just works! – Mr. Tao Apr 18 '18 at 17:54
  • I got following error: "Invalid UTF-8 in decoded subtitles text; maybe missing -sub_charenc option" and had to do `ffmpeg -itsoffset 0.7 -sub_charenc ISO8859-1 -i sub.srt adjusted.srt` – raine Feb 20 '21 at 18:00
6

If you're getting the subtitles from a separate file (ending in .srt) then the easiest way is to paste them into this website, change the delay on the right hand side and press "Simple delay" to download a new subtitle file.

If you absolutely must use a program (rather than a website) then this page has a list of software (for Windows, OS X and Linux) which will not only delay subtitles but do many other useful things. There is also a Super User question asking what the best subtitle editor is.

If the subtitles are already baked into the video, then there is nothing you can do. However since you mention that you're able to change the delay in VLC, then it would suggest that you are using a separate subtitle file.

Richard
  • 5,831
  • 9
  • 44
  • 73