12
votes

Using ffmpeg, I am burning subtitles to a movie using the following:

ffmpeg -i inputfile.mov -vf "subtitles=subtitles.srt:force_style='Alignment=9,Fontsize=8,Outline=0'" $outputfile.mov

Is there a way of delaying/shifting the subtitles start point? Eg have all the subs start 2 seconds later?

2

2 Answers

16
votes

I'm not sure if this is possible in a single invocation, but you can always generate a delayed version of subtitles.srt,

ffmpeg -itsoffset 2 -i subtitles.srt -c copy subtitles_delayed.srt

and then burn it to the movie.

-1
votes

Example for cutting external .srt subtitle file, and/or together with the resulting .mkv video file (with internal subs now), and/or extract the cut internal subs, and/or then burn it (cut .srt file) synchronized into original (.mp4 or .mkv if you want) by proxy (or something...)

First combine the .mp4 and .srt into a .mkv container (if not already so):

ffmpeg -hide_banner -y -i "original.mp4" -i "original.srt" -c copy -c:s srt -metadata:s:s:1 language=eng -map 0 -map 1 -map_metadata 0 "original_subs.mkv"

THEN cut it according to the piece of the movie (or subs) you want to cut: (The subtitles that way are cut on perfect timing like in complete orig. video with ext. subs, other ways gives timing errors.)

ffmpeg -hide_banner -y -ss 01:19:16 -t 00:03:01 -i "original_subs.mkv" -c copy "original_subs_cut.mkv"

To get the cut .srt file:

ffmpeg -hide_banner -y -i "original_subs_cut.mkv" "original_subs_cut.srt"

Then cut and burn the original movie, together with the cut .srt file.

ffmpeg.exe -hide_banner -y -ss 01:19:16 -t 00:03:01 -i "original_subs.mkv" -filter_complex "subtitles=f='original_subs_cut.srt':force_style='FontName=Arial,FontSize=32,Shadow=1'" -strict -2 -c:s mov_text -c:v h264_nvenc -profile:v high -pix_fmt yuv420p -bufsize 20M -bf:v 3 -b:v 1.0M -preset slow -rc:v vbr_hq -rc-lookahead 32 -shortest "original.en.mp4"

Adjust the timings, name, and subtitle parameters (given here as example), change encoder/encoder settings etc. for own format. I have edited the syntax little bit inside here (website editor) so there might be a typo somewhere but if so you will fix that.... Also other combinations / orders of ffmpeg commands can give same and/or other wanted results. If you get a faster method (this is quite fast because of copy) by combining options (like timing together with converting to .mkv container or so) plz let me know... I have not tried that for now.