FFMPEG multiple styles in .srt file

1k views Asked by At

I have an SRT file and want to change the background color and level of transparency for individual tracks. Is this possible, or would I have to adopt a more advanced format? Would this task even work in FFMPEG?

1
0:0:1,440 --> 0:0:1,970  Y1:20
<font color="#FF1F497D">{\an2}the settlement?</font>
2
0:0:2,640 --> 0:0:3,150  Y1:20
<font color="#FFC0504D">{\an2}Yes.</font>
3
0:0:3,740 --> 0:0:4,690  Y1:20
<font color="#FFFFFFFF">{\an2}Have you been waiting long?</font>
1

There are 1 answers

1
llogan On

Use ASS format. It's more advanced and more complicated but it can do what you want.

enter image description here

You can use Aegisub to make or convert the subtitles.

Or ffmpeg can convert SRT to ASS and you can manually add tags.

ffmpeg -i input.srt output.ass

Example ASS file:

[Script Info]
; Script generated by Aegisub 3.2.2
; http://www.aegisub.org/
ScriptType: v4.00+
PlayResX: 384
PlayResY: 288
ScaledBorderAndShadow: yes

[Aegisub Project Garbage]
Last Style Storage: Default

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Arial,16,&H00FFFFFF,&H00FFFFFF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,3,1,0,2,10,10,10,0

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:01.44,0:00:01.97,Default,,0,0,0,,{\c&H00FFFF&\3a&H80&\3c&HFF00FF&}the settlement?{\c}
Dialogue: 0,0:00:02.64,0:00:03.15,Default,,0,0,0,,{\c&H50C0FF&\3a&HA2&\3c&H00FF00&}Yes.{\c}
Dialogue: 0,0:00:03.74,0:00:04.69,Default,,0,0,0,,{\c&HFFFFFF&\3a&H80&\3c&HFF00FF&}Have you been waiting long?{\c}