ffmpeg single quote in drawtext

前端 未结 6 995
粉色の甜心
粉色の甜心 2020-12-09 19:32

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. Doub

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-09 20:04

    // This works for me

    public function replaceSpecialFfmpegChars($text)
        {
            return str_replace(
                ":",
                "\\\\\\\\\\\:",
                str_replace(
                    "%",
                    "\\\\\\\\\\\%",
                    str_replace(
                        "'",
                        "'\\\\\\\\\\\\''",
                        str_replace(
                            "\"",
                            "\\\\\\\\\\\"",
                            str_replace(
                                "\\",
                                "\\\\\\\\\\\\\\\\",
                                $text
                            )
                        )
                    )
                )
            );
        }
    

提交回复
热议问题