I couldn't make a subtitled gif with a proper quality and a subtitle. Here is my bash script:
start_time=00:00:45
duration=5
PALETTE="palette.png"
SUBTITLE="subtitles=sub.srt:force_style='Fontsize=24'"
FILTERS="fps=20,scale=400:-1:flags=lanczos"
ffmpeg -ss $start_time -t $duration -i $1 -vf "$FILTERS,palettegen" -y $PALETTE
ffmpeg -ss $start_time -t $duration -i $1 -i $PALETTE -lavfi "$FILTERS[x];[x][1:v] paletteuse" -y $2 -vf $SUBTITLE
It returns no error, just no subtitle on the output gif. There is a relevant question already here, but it didn't work neither.