[FFmpeg-user] How to use drawtext to overlay dynamic text

Lou lou at lrcd.com
Wed Jun 11 20:11:16 CEST 2014


On Wed, 11 Jun 2014 10:57:50 -0700 (PDT)
Zack Thevenot <zack924 at yahoo.com> wrote:

> 
> 

> I am trying to find a way to use filters to draw dynamic text in the
> same location on my video.  I understand how to draw static text for a
> certain duration, so my plan was to chain multiple of these filters
> together to make a dynamic text overlay, but I didn't find a way to do
> two or more drawtext filters. What is the best way to do something
> like this?  Any help is greatly appreciated.
> 
> This is the command I have so far to make static text
> 
> ffmpeg -i input.h264 -vf
> "drawtext=enable='between(t,0,60)':fontfile=/Windows/Fonts/Tahoma.ttf:fontcolor='White':
> text='100'" -acodec copy output.h264

You can make a linear chain of multiple filters by separating them with
a comma:

  -vf "drawtext,drawtext"

See <http://ffmpeg.org/ffmpeg-filters.html#Filtergraph-syntax-1>

An alternative and possibly easier method would be to make an ASS or SRT
subtitle and use the ass or subtitles filters to make hardsubs:

  -vf "subtitles=subtitles.srt"

See:
http://ffmpeg.org/ffmpeg-filters.html#subtitles
http://ffmpeg.org/ffmpeg-filters.html#ass
https://trac.ffmpeg.org/wiki/HowToBurnSubtitlesIntoVideo

Or mux the subtitles if you prefer softsubs:

 ffmpeg -i video.mkv -i subtitles.ass -codec copy output.mkv

aegisub is an easy to use tool to make such subtitles.


More information about the ffmpeg-user mailing list