<h1>Aegisub</h1>

<p>Use ASS subtitles. Style them in <a href="http://aegisub.org" rel="nofollow noreferrer">Aegisub</a>. You can style each letter or word individually, or apply the desired styling to all subtitles. See the <a href="http://docs.aegisub.org/3.2/Main_Page/" rel="nofollow noreferrer">documentation</a> for detailed instructions.</p>

<p><a href="https://i.sstatic.net/uFoRI.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/uFoRI.png" alt="enter image description here"></a></p>

<p>Example ASS file:</p>

<pre><code>[Script Info]
; Script generated by Aegisub 3.2.2
; http://www.aegisub.org/
Title: Default Aegisub file
ScriptType: v4.00+
WrapStyle: 0
ScaledBorderAndShadow: yes
YCbCr Matrix: None

[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,48,&amp;H00FFFFFF,&amp;H000000FF,&amp;H00000000,&amp;H80000000,0,0,0,0,100,100,0,0,1,6,0,8,10,10,20,1

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:00.00,0:00:05.00,Default,,0,0,0,,Top of canvas. Bigger font size. Thicker stroke.
</code></pre>

<h1>Without Aegisub</h1>

<p>You can apply styling via the <a href="https://ffmpeg.org/ffmpeg-filters.html#subtitles" rel="nofollow noreferrer">subtitles filter</a> <code>force_style</code> option in <code>ffmpeg</code>. This should work with any format that the subtitles filter accepts.</p>

<pre><code>ffmpeg -i input -vf "subtitles=subs.srt:force_style='Alignment=6,Fontsize=48,Outline=8'" output
</code></pre>

<p>Refer to the example ASS file for accepted <code>force_style</code> options, but it will not allow you to style each letter or word individually as you can in Aegisub.</p>

<p>Note that <code>ScaleX</code> and <code>ScaleY</code> values when used in <code>force_style</code> are a factor, not a percentage, so the accurate values would be <code>1,1</code> (not <code>100,100</code>) in that case.</p>

<h1>Transparent background</h1>

<p>This can be tricky due to some limitations of libass, but it is possible. See <a href="https://stackoverflow.com/a/25880038/1109017">How to set background to subtitle in ffmpeg?</a></p>

CC BY-SA 4.0
2018-06-07T00:54:14.323Z
Thanks @LordNeckbeard!!!

I was using Aegisub 3.2.2 on Ubuntu Linux to create these subtitles without exceeding the 15 cps reading speed.
I'll dig into its docs. From [this page on styles](http://docs.aegisub.org/3.2/Styles/) and the [Highlights](http://docs.aegisub.org/3.2/Highlights/) one, at first glance, it seems to me as I can not render the video with hard coded subtitles using Aegisub alone, can I?

For now I kept using the SubRip .srt format and applied your hint on ffmpeg, great!
JazzTp
CC BY-SA 4.0
2018-06-07T01:00:04.513Z
It's 720p and I used this line:

`ffmpeg -i input.mp4 -vf "subtitles=subs.srt:force_style='Alignment=6,Fontsize=22,Outline=2'" -c:a copy -c:v libx264 -crf 22 -preset slower output_Alignment_6_Fontsize_22_Outline_2___slower.mp4`

(Separate comment because otherwise it was too long, the platform didn't allow it. I guess I should "accept" you answer but can't see how to do it, yet.)
JazzTp
CC BY-SA 4.0
2018-06-07T01:13:08.427Z
could you please point me to exhaustive docs on how to use the force_style option? I can only find examples here and there on the web, e.g. no alignment options explained (tried 7 out of curiosity and it's top-right).

Again **THANK YOU A LOT!** (I tried to upvote your answer, the platform says it gets recorded but not visible to the public because I don't have enough reputation... maybe that's also why I don't find any button or link to "accept" your answer, I hope you won't mind, sorry.)
JazzTp
CC BY-SA 4.0
2018-06-07T01:42:22.727Z
@JazzTp I'm not sure if you can use Aegisub alone to hardsub, and laziness prevents me from looking it up. I've only used it to create subtitle files. Alignment is described under [Line Alignment](http://docs.aegisub.org/3.2/ASS_Tags/#\a) (refer to `\a` and `\an` tags). `force_style` seems to use the legacy positioning (`\a`) which makes less sense than the more current "number pad" positioning system (`\an`). Only documentation on `-force_style` is under the subtitles filter docs which I linked to in the answer, but the ASS Tags page will help.
llogan
CC BY-SA 4.0
2018-06-08T02:49:02.040Z
**Thank you again** @LordNeckbeard everything clear (impressive possibilities with the Advanced Substation Alpha format).
JazzTp
CC BY-SA 4.0
2018-06-09T06:24:15.957Z
force_style only implements the tags set per-style in the INI section of the ASS file.
Gyan
CC BY-SA 4.0
2018-06-12T19:23:10.020Z
It worked with the ASS format: `ffmpeg -i input.mp4 -vf "subtitles=subs.ass" -c:a copy -c:v libx264 -crf 22 -preset slower output_subsASS_Alignment_8_Font_Arial_55_Outline_5.0___slower.mp4` - Thank you @Gyan, I've actually just seen your comment (which I do not fully understand yet to be honest) when coming here to add this one.
JazzTp
CC BY-SA 4.0
2018-06-12T19:24:46.403Z
An example with srt format _and_ where the original video needed rescaling, because it was too low res to carry the subtitles text in decent resolution:
`ffmpeg -i input.mp4 -vf "scale=1080x720,subtitles=subs.srt:force_style='Alignment=2,Fontsize=22,Outline=2'" -c:a copy -c:v libx264 -crf 22 -preset slower output_1080x720_Alignment_2_Fontsize_22_Outline_2___slower.mp4`
JazzTp
CC BY-SA 4.0
2019-08-14T00:03:00.653Z
Interestingly, fonts come out bigger when using the same font size in the force_style option versus when used in Pinta (Ubuntu graphic editor). Any thoughts on why this is the case?
Roel Van de Paar
CC BY-SA 4.0
2019-08-19T17:41:34.277Z
@RoelVandePaar Never heard of Pinta. Maybe a difference in font sizing (pixels vs picas vs points).
llogan
CC BY-SA 4.0
2018-06-05T19:26:29.850Z
2019-05-21T18:30:50.233Z
2019-05-21T18:30:50.233Z
llogan
<p>I found this page (I can't comment or answer there so here's a new question):</p>

<p><a href="https://video.stackexchange.com/questions/5160/render-srt-subtitles-to-video?newreg=ca036f1e34f94d65918b40afdb90f786">Render srt subtitles to video?</a></p>

<p>with this line which works fine:</p>

<pre><code>ffmpeg -i input.mp4 -filter:v subtitles=subtitle.srt -c:a copy -c:v libx264 -crf 22 -preset veryfast output.mp4
</code></pre>

<p>I need the following and can't get it done:</p>

<ul>
<li>subtitles lines start from the TOP of the canvas</li>
<li>subtitles have bigger character size and thicker stroke</li>
<li>subtitles area has a semi-transparent dark background</li>
</ul>

<p><strong>mencoder</strong> might be another viable manner to do it.</p>

<ffmpeg><subtitles>
ffmpeg hardcoded subtitles from the top, bigger, with thicker stroke, on a dark background
JazzTp
# ffmpeg hardcoded subtitles from the top, bigger, with thicker stroke, on a dark background

(Asked by: username_0 on 2018-06-04)

I found this page (I can't comment or answer there so here's a new question):
Render srt subtitles to video?
with this line which works fine:
ffmpeg -i input.mp4 -filter:v subtitles=subtitle.srt -c:a copy -c:v libx264 -crf 22 -preset veryfast output.mp4

I need the following and can't get it done:

subtitles lines start from the TOP of the canvas
subtitles have bigger character size and thicker stroke
subtitles area has a semi-transparent dark background

mencoder might be another viable manner to do it.

**Tags:** ffmpeg, subtitles


---

## 1 answers

### Answer by username_1 on 2018-06-05. Score: 5

Aegisub
Use ASS subtitles. Style them in Aegisub. You can style each letter or word individually, or apply the desired styling to all subtitles. See the documentation for detailed instructions.

Example ASS file:
[Script Info]
; Script generated by Aegisub 3.2.2
; http://www.aegisub.org/
Title: Default Aegisub file
ScriptType: v4.00+
WrapStyle: 0
ScaledBorderAndShadow: yes
YCbCr Matrix: None

[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,48,&H00FFFFFF,&H000000FF,&H00000000,&H80000000,0,0,0,0,100,100,0,0,1,6,0,8,10,10,20,1

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:00.00,0:00:05.00,Default,,0,0,0,,Top of canvas. Bigger font size. Thicker stroke.

Without Aegisub
You can apply styling via the subtitles filter force_style option in ffmpeg. This should work with any format that the subtitles filter accepts.
ffmpeg -i input -vf "subtitles=subs.srt:force_style='Alignment=6,Fontsize=48,Outline=8'" output

Refer to the example ASS file for accepted force_style options, but it will not allow you to style each letter or word individually as you can in Aegisub.
Note that ScaleX and ScaleY values when used in force_style are a factor, not a percentage, so the accurate values would be 1,1 (not 100,100) in that case.
Transparent background
This can be tricky due to some limitations of libass, but it is possible. See How to set background to subtitle in ffmpeg?

> **Comments:**
> **username_0**: Thanks @LordNeckbeard!!!  I was using Aegisub 3.2.2 on Ubuntu Linux to create these subtitles without exceeding the 15 cps reading speed. I'll dig into its docs. From [this page on styles](http://docs.aegisub.org/3.2/Styles/) and the [Highlights](http://docs.aegisub.org/3.2/Highlights/) one, at first glance, it seems to me as I can not render the video with hard coded subtitles using Aegisub alone, can I?  For now I kept using the SubRip .srt format and applied your hint on ffmpeg, great!  
> **username_0**: It's 720p and I used this line:  `ffmpeg -i input.mp4 -vf "subtitles=subs.srt:force_style='Alignment=6,Fontsize=22,Outline=2'" -c:a copy -c:v libx264 -crf 22 -preset slower output_Alignment_6_Fontsize_22_Outline_2___slower.mp4`  (Separate comment because otherwise it was too long, the platform didn't allow it. I guess I should "accept" you answer but can't see how to do it, yet.)  
> **username_0**: could you please point me to exhaustive docs on how to use the force_style option? I can only find examples here and there on the web, e.g. no alignment options explained (tried 7 out of curiosity and it's top-right).  Again **THANK YOU A LOT!** (I tried to upvote your answer, the platform says it gets recorded but not visible to the public because I don't have enough reputation... maybe that's also why I don't find any button or link to "accept" your answer, I hope you won't mind, sorry.)  
> **username_1**: @username_0 I'm not sure if you can use Aegisub alone to hardsub, and laziness prevents me from looking it up. I've only used it to create subtitle files. Alignment is described under [Line Alignment](http://docs.aegisub.org/3.2/ASS_Tags/#\a) (refer to `\a` and `\an` tags). `force_style` seems to use the legacy positioning (`\a`) which makes less sense than the more current "number pad" positioning system (`\an`). Only documentation on `-force_style` is under the subtitles filter docs which I linked to in the answer, but the ASS Tags page will help.  
> **username_0**: **Thank you again** @LordNeckbeard everything clear (impressive possibilities with the Advanced Substation Alpha format).  
> **username_2**: force_style only implements the tags set per-style in the INI section of the ASS file.  
> **username_0**: It worked with the ASS format: `ffmpeg -i input.mp4 -vf "subtitles=subs.ass" -c:a copy -c:v libx264 -crf 22 -preset slower output_subsASS_Alignment_8_Font_Arial_55_Outline_5.0___slower.mp4` - Thank you @username_2, I've actually just seen your comment (which I do not fully understand yet to be honest) when coming here to add this one.  
> **username_0**: An example with srt format _and_ where the original video needed rescaling, because it was too low res to carry the subtitles text in decent resolution: `ffmpeg -i input.mp4 -vf "scale=1080x720,subtitles=subs.srt:force_style='Alignment=2,Fontsize=22,Outline=2'" -c:a copy -c:v libx264 -crf 22 -preset slower output_1080x720_Alignment_2_Fontsize_22_Outline_2___slower.mp4`  
> **username_3**: Interestingly, fonts come out bigger when using the same font size in the force_style option versus when used in Pinta (Ubuntu graphic editor). Any thoughts on why this is the case?  
> **username_1**: @RoelVandePaar Never heard of Pinta. Maybe a difference in font sizing (pixels vs picas vs points).  

---

