使用FFMpeg时如何对引号,双引号和双引号内的冒号进行换行

时间:2020-09-22 22:16:49

标签: ffmpeg

我正在尝试将文字写到视频上。我可以在单行中使用它,而在需要用双引号引起引用的drawtext来写两行时,则无法使用它。

ffmpeg.exe -i input.ts -vf "[in]drawtext=fontfile=Bebas-Regular.ttf:text='"Day: Sunday"':fontcolor=white:y=(h-h*0.2):x=(w-w*0.95):fontsize=36, drawtext=fontfile=Bebas-Regular.ttf:text='"thing1, thing2, thing3"':fontcolor=white:y=(h-h*0.1):x=(w-w*0.95):fontsize=36[out]" -codec:a copy output1.mp4

我已经尝试了很多\的组合,但是我无法使其正常工作。我收到的错误如下:

Unable to find a suitable output format for 'Sunday':fontcolor=white:y=(h-h*0.2):x=(w-w*0.95):fontsize=36, drawtext=fontfile=Bebas-Regular.ttf:text='thing1,'
Sunday':fontcolor=white:y=(h-h*0.2):x=(w-w*0.95):fontsize=36, drawtext=fontfile=Bebas-Regular.ttf:text='thing1,: Invalid argument

我需要视频具有此内容:

Day: Sunday
Thing1, Thing2, Thing3

1 个答案:

答案 0 :(得分:0)

这种单引号嵌入双引号字符串中的形式对我有用:

-vf "[in]drawtext=fontfile=Font.ttf:text='thing1, thing2, thing3'"

有关如何显示单引号或单引号,请参见https://stackoverflow.com/a/10729560/13223986

另请参阅drawtext documentation