Multiple effect overlays with FFmpeg


This subject was discussed here before but my problem is a little different. I have a transparent tiff sequence with sequential numbers that I wish to overlay on top of another tiff sequence in order to create a video file.

In addition, I'd like to add a text overlay from a text file using the drawtext filter.

Seperatly, I've managed to do both of these actions but when I try to combine them to a single command line, the code either doesn't work or it produces only one of the video filters.

This is the code I've used for the sequential numbers overlay:

ffmpeg -i sc060_sh0050_v02.%4d.tif -i %d.tif -vcodec v210 -filter_complex overlay -shortest

And this is the code I've used for the title overlay:

ffmpeg -f image2 -i sc060_sh0050_v02.%4d.tif -vcodec v210 -vf "[in]drawtext=fontfile=Arial.ttf: fontsize=50: textfile=filename.txt: r=25: x=100: y=(lh): fontcolor=0x76FF08: box=1: boxcolor=0x00000099[out]" -y

Does anyone know of a way I can make both effects work in a single command line?

asked on Super User Mar 18, 2013 by Kobi Versano • edited May 23, 2017 by Community

1 Answer

ffmpeg \
-i sc060_sh0050_v02.%4d.tif \
-i %d.tif \
-vcodec v210 \
-filter_complex "[0:v][1:v]overlay,drawtext=fontfile=Arial.ttf:fontsize=50:textfile=filename.txt: r=25: x=100: y=(lh): fontcolor=0x76FF08: box=1: boxcolor=0x00000099" \
-shortest \
-y \
  1. You must use filter_complex because an overlay has two inputs.
  2. First overlay sequence %d.tiff over sc060_sh0050_v02.%4d.tif
  3. Add the drawtext filter. Note the comma between overlay and drawtext chains the filters.
answered on Super User Oct 11, 2017 by Rens • edited Oct 11, 2017 by Rens

User contributions licensed under CC BY-SA 3.0