[FFmpeg-user] How to add own, subtitles (resp. pure text) into existing MP4 video?

Micael Silva micaelsilva at gmail.com
Sun Dec 9 15:30:23 EET 2018


On Sun, Dec 9, 2018 at 10:56 AM Ben <bxstover-at-yahoo.co.uk at ffmpeg.org>
wrote:

> Assume I have an existing well-encoded MP4 video WITHOUT subtitles.
>
> Now I want to add the text "foobar testtext" with fontsize=18 and
> fontfamily Verdana into video beginning at 1min23sec and ending at
> 3min44sec centralized 30 pixels above lower border.
>
> How can I most easily achieve this with ffmpeg?
>
> I possible/necessary the text could be put fix encoded into video and not
> only as traditional subtitle.
>

Reeconde using drawtext filter like:

- vf
"drawtext=enable='between(t,83,224)':fontfile=/path/to/Verdana.ttf:text='foobar
testtext':fontcolor=white:fontsize=18:x=(w/2)-(tw/2):y='(0-max_glyph_a)+(h-30)'"

'enable' is a timeline editor, activating the filter only when the time is
between 83 seconds (1min23s) and 224 seconds (3min44s). X coordinate is
calculated with the middle of the text and the middle of the input video
and Y coordinate with the heigth total of the text and the height of input
video minus 30 pixels


More information about the ffmpeg-user mailing list