drawtext ffmpeg 倾斜,ffmpeg在drawtext中单引号

博客讨论了 FFmpeg 的 drawtext 视频滤镜在处理单引号时的问题,即便对单引号进行转义,在 'text=' 参数中仍无法正常显示,而双引号和从文件加载的文本中的单引号显示正常。给出解决方案,可多次转义单引号,或使用文本文件加载文本。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I haven't been able to get ffmpeg's drawtext video filter to draw apostrophes/single quotes when they are in drawtext's "text=" parameter, even when I escape them. Double quotes work fine, and apostrophes in text loaded from a file (e.g. textfile="example.txt") work fine. Is this a bug?

e.g.

ffmpeg -i test.mpg -vf drawtext="apostrophes don't print" ...

ffmpeg -i test.mpg -vf drawtext="even when they\'re escaped" ...

解决方案

Special character escapes are like violence: if they're not solving your problem, you're not using enough.

ffmpeg -i test.mpg -vf drawtext=text="It\\\\\'s so easy"

Produces a textual overlay that includes an apostrophe. The text is being parsed a couple times, so you not only have to escape the quote, you also have to escape the slash escaping the quote. Twice.

Your alternative of using a textfile might be a better method in this situation.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值