【问题标题】:How to use if statement to add color overlay in FFMPEG如何使用 if 语句在 FFMPEG 中添加颜色叠加
【发布时间】:2020-12-25 16:06:09
【问题描述】:
ffmpeg -i input.mp4 -y -t 10 -vf drawbox=x=0:y=0:w=200:h=200:color='if(1==1\,red\,green)':t=fill output.mp4

我尝试测试如何使用 if 语句将彩色方形叠加层添加到视频中,但出现以下错误。

找不到颜色 'if(1==1,red,green)' [AVFilterGraph @ 000002d24a659440] 使用参数“x=0:y=0:w=200:h=200:color=if(1==1,red,green):t=fill”初始化过滤器“drawbox”时出错 重新初始化过滤器时出错! 无法将帧注入过滤器网络:参数无效 处理流 #0:0 的解码数据时出错

【问题讨论】:

    标签: if-statement ffmpeg


    【解决方案1】:

    根据documentation of FFmpeg on Expression Evaluation 相等性应使用eq(x,y) 进行测试,这是文档所说的:

    eq(x, y) 如果 x 和 y 相等则返回 1,否则返回 0。

    这可能是出于测试目的,但我必须提到if(eq(1\,1)\,red\,green) 将始终返回red

    如果(x, y, z) 对x求值,如果结果非零则返回y的求值结果,否则返回z的求值结果。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-02-17
      • 2015-12-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-20
      相关资源
      最近更新 更多