I' going to add some text to a video segment using -vf but it doesn't work. Here is what I tried

avconv -ss 00:00:20 -i input.mp4 -t 00:00:10 -vcodec copy -acodec copy \
  -vf "drawtext=fontfile='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf':text='hello world':x=0:y=0:fontsize=24:fontcolor=black" output.mp4

But the text doesn't show up. I know that -t argument should appear after -i or the duration won't be set. I wonder if I misplace -vf in this case. Would anyone tell me how to make it?

P.S. I install it with apt-get install ffmpeg. Software info:

avconv version 0.8.9-6:0.8.9-0ubuntu0.13.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Nov  9 2013 19:09:48 with gcc 4.7.3

2 Answers 2


In case we want to add text to our video using the drawtext filter we can not make use of the copy video codec.

Adding text to a video will change the video data. Therefore we have to re-encode the video stream using any codec other than copy.

  • If I remove -vcodec avconv will report an error "encoder 'aac' is experimental and might produce bad results. Add '-strict experimental' if you want to use it." Is it any mistakes I made during installation?
    – neuront
    Mar 19, 2014 at 9:52
  • Your source may be aac encoded... you can choose any vcodec or acodec supported for re-encoding, or use the -target option for some defaults. See libav.org/avconv.html#Codec-AVOptions
    – Takkat
    Mar 19, 2014 at 10:15
  • 1
    In fact I didn't have libavcodec-extra-53 installed. After an apt-get it is now all right.
    – neuront
    Mar 19, 2014 at 10:19

The following command worked for me:

avconv -i input.mp4 -vf "drawtext=fontfile='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf':text='hello world':x=0:y=0:fontsize=24:fontcolor=black" output.mp4

tested on this mp4 sample file.

Not the answer you're looking for? Browse other questions tagged or ask your own question.