I am adding an animated gif as an overlay to a video with a command like this:
ffmpeg -y -i video.mp4 -i overlay.gif -filter_complex "[0:v][1:v] overlay=38