Subtitle not visible while converting GIF with ffm

2019-09-14 23:14发布

问题:

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.

回答1:

FILTERS should include the subtitles filter.

FILTERS="fps=20,scale=400:-1:flags=lanczos,subtitles=sub.srt:force_style='Fontsize=24'"

And remove -vf $SUBTITLE