<p>Use the <a href="https://ffmpeg.org/ffmpeg-filters.html#subtitles" rel="nofollow noreferrer">subtitles</a> filter and it will wrap automatically. You can use the simple but limited SRT format, or the more complex ASS format. Aegisub is useful if you want to format the subtitles, or see the <code>force_style</code> option in the subtitles filter.</p>

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

<pre><code>ffmpeg -i input.mp4 -vf "subtitles=title.srt,format=yuv420p" -c:v libx264 -c:a copy -movflags +faststart output.mp4
</code></pre>

CC BY-SA 4.0
2019-09-17T18:35:01.193Z
I'd also like(the caption) to be in the bottom or on the top of the video as it is in the picture in the question
archie
CC BY-SA 4.0
2019-09-17T18:37:51.697Z
@archie Yes, that is possible. Refer to *Alignment* or `\an` or `\pos` tags. http://docs.aegisub.org/3.2/ASS_Tags/
llogan
CC BY-SA 4.0
2019-09-18T17:37:11.197Z
How is the title.srt supposed to be like? I'm getting "Conversion failed" message
archie
CC BY-SA 4.0
2019-09-18T18:38:26.387Z
@archie [Example](https://en.wikipedia.org/wiki/SubRip). But you should be using ASS since it supports the `\an` and `\pos` tags.
llogan
CC BY-SA 4.0
2019-09-17T18:22:19.687Z
2019-09-17T18:22:19.687Z
llogan
<p>The <code>drawtext</code> filter <em>doesn't support automatic wrapping.</em></p>

<p>So, if you want to display your text in <em>n</em> lines, you have to use the <code>drawtext</code> filter <em>n</em> times, <em>with different values</em> for parameters <code>text</code>, <code>y</code> (and maybe <code>x</code>, too) for every line.</p>

CC BY-SA 4.0
2019-09-18T17:35:47.683Z
Would it be responsive that way?
archie
CC BY-SA 4.0
2019-09-17T18:18:40.937Z
2019-09-17T18:18:40.937Z
MarianD
<p>I'm trying to add text to my video. Something like this:</p>

<p><a href="https://i.sstatic.net/1GLC6.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/1GLC6.jpg" alt=""></a></p>

<p>So far I've tried this command, <strong>but the text doesn't wrap</strong>:</p>

<pre><code>ffmpeg -i input.mp4 -vf \
"format=yuv444p, \
drawbox=y=ih/PHI:color=black@0.4:width=iw:height=48:t=fill, \
drawtext=fontfile=OpenSans-Regular.ttf:text='Title of this    Video':fontcolor=white:fontsize=24:x=(w-tw)/2:y=(h/PHI)+th, \
format=yuv420p" \
-c:v libx264 -c:a copy -movflags +faststart output.mp4
</code></pre>

<ffmpeg>
How to add lower third text graphics to a video using FFmpeg
archie
# How to add lower third text graphics to a video using FFmpeg

(Asked by: username_0 on 2019-09-17)

I'm trying to add text to my video. Something like this:

So far I've tried this command, but the text doesn't wrap:
ffmpeg -i input.mp4 -vf \
"format=yuv444p, \
drawbox=y=ih/PHI:color=black@0.4:width=iw:height=48:t=fill, \
drawtext=fontfile=OpenSans-Regular.ttf:text='Title of this    Video':fontcolor=white:fontsize=24:x=(w-tw)/2:y=(h/PHI)+th, \
format=yuv420p" \
-c:v libx264 -c:a copy -movflags +faststart output.mp4

**Tags:** ffmpeg


---

## 2 answers

### Answer by username_1 on 2019-09-17. Score: 1

Use the subtitles filter and it will wrap automatically. You can use the simple but limited SRT format, or the more complex ASS format. Aegisub is useful if you want to format the subtitles, or see the force_style option in the subtitles filter.

ffmpeg -i input.mp4 -vf "subtitles=title.srt,format=yuv420p" -c:v libx264 -c:a copy -movflags +faststart output.mp4

> **Comments:**
> **username_0**: I'd also like(the caption) to be in the bottom or on the top of the video as it is in the picture in the question  
> **username_1**: @username_0 Yes, that is possible. Refer to *Alignment* or `\an` or `\pos` tags. http://docs.aegisub.org/3.2/ASS_Tags/  
> **username_0**: How is the title.srt supposed to be like? I'm getting "Conversion failed" message  
> **username_1**: @username_0 [Example](https://en.wikipedia.org/wiki/SubRip). But you should be using ASS since it supports the `\an` and `\pos` tags.  

---

### Answer by username_2 on 2019-09-17. Score: 0

The `drawtext` filter *doesn't support automatic wrapping.*

So, if you want to display your text in *n* lines, you have to use the `drawtext` filter *n* times, *with different values* for parameters `text`, `y` (and maybe `x`, too) for every line.

> **Comments:**
> **username_0**: Would it be responsive that way?  

---

