2

I'm currently converting a video to a gif with the following command (taken from this example)

ffmpeg -y -ss 30 -t 3 -i input.flv \
-vf fps=10,scale=320:-1:flags=lanczos,palettegen palette.png

ffmpeg -ss 30 -t 3 -i input.flv -i palette.png -filter_complex \
"fps=10,scale=320:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif

What I'm trying to accomplish is have text show on the top of the gif while it plays but I'm slightly confused as to how I add in the command below tweaked from this example

drawtext="fontfile=/path/to/font.ttf: \
text='Stack Overflow': fontcolor=black: x=160: y=-1"
nadermx
  • 667
  • 1
  • 10
  • 32

1 Answers1

2

You would insert it after the scaling but before the palette filters.

ffmpeg -y -ss 30 -t 3 -i input.flv \
-vf fps=10,scale=320:-1:flags=lanczos,drawtext="fontfile=/path/to/font.ttf: \
 text='Stack Overflow': fontcolor=black: x=160: y=-1",palettegen palette.png

ffmpeg -ss 30 -t 3 -i input.flv -i palette.png -filter_complex \
"fps=10,scale=320:-1:flags=lanczos,drawtext="fontfile=/path/to/font.ttf: \
 text='Stack Overflow': fontcolor=black: x=160: y=-1"[x];[x][1:v]paletteuse" output.gif
Gyan
  • 34,439
  • 6
  • 56
  • 98