0

I have several thousand .gif files (with alpha channels) and I want to add a single red pixel (no transparency) in the bottom left hand corner of each .gif file. Each one has different dimensions.

How can I do this easily with ffmpeg?

joejoejoejoe4
  • 1,438
  • 9
  • 25
  • 48

1 Answers1

1

Adapting How do I convert a video to GIF using ffmpeg, with reasonable quality? by adding the drawbox filter:

ffmpeg -i input.gif -vf "drawbox=x=0:y=ih-h:w=1:h=1:color=red:t=fill:replace=1,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" output.gif

If the pixel does not show up increase the h value or you may have to adjust the options for palettegen/paletteuse.

llogan
  • 57,139
  • 15
  • 118
  • 145
  • Thanks. I had to make h 2 for it to show up, but it looks like that made it 2 pixels in height. Although this is good enough for my purposes, I guess I'm curious why it doesn't work when h = 1. – joejoejoejoe4 Oct 08 '21 at 20:47
  • @jippyjoe4 I don't know. Probably something to do with palettegen. Check the source code. – llogan Oct 09 '21 at 00:24