user26292: 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


user1760: 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


26292: <p>I'm trying to add text to my video. Something like this:</p>

<p><a href="https://i.stack.imgur.com/1GLC6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/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>
 1760: <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.stack.imgur.com/7T1oK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/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>
