[FFmpeg-user] how to use drawtext?

Richard Duran ricdur2 at gmail.com
Wed Oct 30 21:20:54 CET 2013


On Wed, Oct 30, 2013 at 4:19 AM, Frank Tetzel <
s1445051 at mail.zih.tu-dresden.de> wrote:

> Hi,
>
> have a look at the filter documentation. There are many examples:
> http://ffmpeg.org/ffmpeg-filters.html#Examples-8
>
> The third one should help you.
>
> Regards,
> Frank.
>

I actually was trying that very one, but I'm a novice ffmpeg user and am
still trying to really understand chains, filters and overlays.

Could you offer an example that injects the 3rd example into what I'm
already doing?

I have used the following command successfully:

ffmpeg -f lavfi -i testsrc -f lavfi -i testsrc -filter_complex
"[0:v]setpts=PTS-STARTPTS, pad=iw*2.1:ih[bg]; [1:v]setpts=PTS-STARTPTS[fg];
[bg][fg]overlay=w*1.1" -t 5 test1.mp4

So I tried appending "; drawtext=fontsize=30:fontfile=arial.ttf:text='hello
world':x=(w-text_w)/2:y=(h-text_h-line_h)/2" to my "complex" filter, and
got the following error:

ffmpeg -f lavfi -i testsrc -f lavfi -i testsrc -filter_complex
"[0:v]setpts=PTS-STARTPTS, pad=iw*2.1:ih[bg]; [1:v]setpts=PTS-STARTPTS[fg];
[bg][fg]overlay=w*1.1; drawtext=fontsize=30:fontfile=arial.ttf:text='hello
world':x=(w-text_w)/2:y=(h-text_h-line_h)/2" -t 5 test2.mp4
ffmpeg version N-56749-g7057cc8 Copyright (c) 2000-2013 the FFmpeg
developers
  built on Sep 29 2013 18:07:44 with gcc 4.8.1 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc
--enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus
--enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264
--enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 46.100 / 52. 46.100
  libavcodec     55. 33.101 / 55. 33.101
  libavformat    55. 18.104 / 55. 18.104
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 88.100 /  3. 88.100
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240
[SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Input #1, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #1:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240
[SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Cannot find a matching stream for unlabeled input pad 0 on filter
Parsed_drawtext_4


More information about the ffmpeg-user mailing list