ffmpeg drawtext and watermark only creates watermark but no text

11,431

You should perform the filtering in one filtergraph:

ffmpeg -i i.mp4 -i watermarkfile.png -filter_complex \
"[0:v]drawtext=fontfile=/path/to/fonts/FreeSans.ttf:text='TESTING':[email protected]:fontsize=36:x=00:y=40[text]; \
[text][1:v]overlay[filtered]" -map "[filtered]" \
-map 0:a -codec:v libx264 -codec:a copy output.mp4
  • Use -filter_complex instead of -vf with multiple inputs and/or outputs.
  • You do not need to use the movie multimedia source filter.
  • The audio can be stream copied instead of being re-encoded.
  • See the FFmpeg and x264 Encoding Guide for encoding suggestions.
  • See the documentation on the drawtext and overlay video filters for more info.
Share:
11,431

Related videos on Youtube

tomsv
Author by

tomsv

Updated on September 18, 2022

Comments

  • tomsv
    tomsv almost 2 years

    If I try to add a text and a watermark at the same time, only the watermark shows.

    ffmpeg -i i.mp4 -vcodec libx264 -f mp4 
      -vf drawtext="fontfile=/[...]/share/fonts/freefont-ttf/FreeSans.ttf
        :text='TESTING':[email protected]:fontsize=36:x=00: y=40" 
      -vf 'watermarkfile.png [watermark]; [in][watermark] overlay=0:0 [out]' o.mp4
    

    (All in one line. Here I have added line breaks for clarity.)

    If I remove the watermark part, the text appears instead, as follows:

    ffmpeg -i i.mp4 -vcodec libx264 -f mp4 
      -vf drawtext="fontfile=/[...]/share/fonts/freefont-ttf/FreeSans.ttf
        :text='TESTING':[email protected]:fontsize=36:x=00: y=40" 
      o.mp4
    

    But how can I get both text and watermark at the same time?

    • Elisa Cha Cha
      Elisa Cha Cha over 10 years
      You should always also include the complete ffmpeg console output.
  • tomsv
    tomsv over 10 years
    Thanks. Here is a continuation of this question: superuser.com/q/706373/217699
  • Chinmay235
    Chinmay235 almost 8 years
    How to add special character in my watermark text? Here I posted question. Please answer me - stackoverflow.com/questions/38266469/…