使用ffmpeg转换GIF时,字幕不可见 [英] Subtitle not visible while converting GIF with ffmpeg
本文介绍了使用ffmpeg转换GIF时,字幕不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法制作具有适当质量和副标题的字幕gif。这是我的bash脚本:
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
它不返回任何错误,在输出gif上也没有字幕。有一个相关的问题已经这里
It returns no error, just no subtitle on the output gif. There is a relevant question already here, but it didn't work neither.
推荐答案
FILTERS应该包含字幕过滤器。
FILTERS should include the subtitles filter.
FILTERS="fps=20,scale=400:-1:flags=lanczos,subtitles=sub.srt:force_style='Fontsize=24'"
并删除 -vf $ SUBTITLE
这篇关于使用ffmpeg转换GIF时,字幕不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文