ffmpeg -i bullet.train.mp4 \
-f segment -segment_time 00:55:00 -reset_timestamps 1 \
-c:v mpeg2video -c:a mp2 -b:v 2500k -b:a 128k -s 700x300 -af volume=8.0 \
-vf "subtitles=filename=bullet.train.srt:force_style='FontSize=26,PrimaryColour=&h00ffff,Bold=1,Shadow=3'" \
-y bullet.train.%02d.mpg
-
The segment format is to split the output file in chunks of segment_time duration files.
-
The reset_timestamps is to keep subtitles syncronized in the next chunk.
-
The force_style parameter must use single quotes.
-
The .srt file must not be too nested in deep subdirs.
-
Ensure the .srt file is UTF-8 to avoid ffmpeg does not hardcode them into the video file.
-
Avoid spaces and special characters in the subtitles filename.
-
Preferably execute the command in the same dir containing video and subtitle.
-
The ffmpeg parameters order, matters.
-
The hex primary color value is yellow.
mpgtx -2 bullet.train.mpg -b bullet.train
- Will split the MPG original file in two files.
ffmpeg -threads 1 -i MissionImpossible_DeadReckoningPartOne2023.mkv \
-f segment -segment_time 00:55:00 -reset_timestamps 1 \
-c:v mpeg2video -c:a mp2 -b:v 2500k -b:a 128k -s 700x300 \
-af volume=8.0 -vf "subtitles=MissionImpossible_DeadReckoningPartOne2023.srt:force_style='FontSize=26,Shadow=3,Bold=1,PrimaryColour=&H00ffff&'" \
-y mision.imp.3.%02d.mpg
ffmpeg -threads 1 -i MissionImpossible_DeadReckoningPartOne2023.mkv \
-f segment -segment_time 00:55:00 -reset_timestamps 1 -c:v mpeg2video \
-c:a mp2 -b:v 2500k -b:a 128k -s 700x300 -af volume=8.0 \
-vf "subtitles=MissionImpossible_DeadReckoningPartOne2023.srt:force_style='FontSize=26,Shadow=3,Bold=1,PrimaryColour=&H00ffff&',smartblur=lr=1.0" \
-y mision.imp.3.%02d.mpg
- Note that smartblur filter goes inside the same quotes of subtitles filter. If you use separate -vf options ffmpeg will only use the last.
- Before that, try to convert to UTF-8 the subtitles SRT file.
ffmpeg -i captain_america_brave_new_world.mp4 -i captain_america_brave_new_world.m4a \
-map 0:v:0 -map 1:a:0 -f segment -segment_time 00:55:00 -reset_timestamps 1 \
-c:v mpeg2video -c:a mp2 -b:v 2500k -b:a 128k -s 700x300 -af volume=8.0 \
-vf "subtitles=filename=captain_america_brave_new_world.srt:force_style='FontSize=30,PrimaryColour=&h00ffff,Bold=1,Shadow=3',smartblur=lr=0.8" \
-y brave_new_world.%02d.mpg