I can successfully use FFmpeg's concat filter and the drawtext filter in separate commands.

But this requires two encoding runs.

Is it possible to get both of these filters to work in a chain, so that only one encoding takes place? How?

I have three video clips I am trying to concatenate and I want one common text to appear over the resulting video.

  • Are the videos with different codecs / encoding settings? If not you could use the concat demuxer or protocol instead of the filter.
    – slhck
    Oct 22, 2013 at 5:59
  • Yes, unfortunately the videos have different encoding settings and I cannot control this. To join them, I must use the concat filter. But I cannot figure out how to combine the concat filter with the drawtext filter in one statement.
    – fionasdad
    Oct 22, 2013 at 16:02
  • Please include some information (the complete console output) about your inputs: ffmpeg -i input1 -i input2 -i input3
    – llogan
    Oct 22, 2013 at 18:15
  • I'm on Windows. How do I produce the complete console output that you would like to see?
    – fionasdad
    Oct 22, 2013 at 19:11
  • :) Thanks, but I know how to direct the output of FFmpeg to a text file. What I meant was I do not know how to run FFmpeg on my three input files so that it produces the report you want. I tried: ffmpeg -i input1 -i input2 -i input3. When doing so I replaced the inputs with my actual three videos. The only output was an error message that I did not provide an output. So what is this complete console output? Thanks.
    – fionasdad
    Oct 22, 2013 at 23:26

1 Answer 1


Try this:

ffmpeg -i inputfile1 -i inputfile2 -y \
-filter_complex '[0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a];\
[v]drawtext=fontsize=72:fontcolor=White:fontfile=/usr/share/fonts/truetype/DejaVuSans.ttf:text=Text Line To Render:x=(w)/2:y=(h)/2[o]'\
-map '[o]' -map '[a]' ...other encoding parameters... outputfile

Note that [v] and [a] are just labels – you could very well use [p] and [q] and that would be fine too. Only stream 0 goes to first label and stream 1 to second label. So I'm assuming stream 0 is video.

You have to ensure that the streams in inputfile1 and inputfile2 have the same order. Then we pass the output of video stream as input to the drawtext filter by saying [v]drawtext=....

The output of this is now labeled as [o] at the end of the drawtext parameters. By saying -map [o], we use the output from drawtext to pass on forward to your other encoding parameters.

The font path I'm using is from OpenSUSE. Yours could be different.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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