我正在尝试使用透视过滤器在 ffmpeg 中创建伪 3d 平移效果。
这是起点的示例...
ffmpeg -y -filter-complex "color=black:s=1600x900,trim=0:5,drawgrid=width=100:height=100:thickness=2:color=white,perspective=x0=200:y0=200:x1=1600:y1=0:x2=200:y2=700:x3=1600:y3=900[skew]" -an -map [skew] "skew-start.mp4"
这是终点的示例...ffmpeg -y -filter-complex "color=black:s=1600x900,trim=0:5,drawgrid=width=100:height=100:thickness=2:color=white,perspective=x0=0:y0=0:x1=1600:y1=0:x2=0:y2=900:x3=1600:y3=900[skew]" -an -map [skew] "skew-end.mp4"
到目前为止,一切都很好。添加动画会给出这个......ffmpeg -y -filter-complex "color=black:s=1600x900,trim=0:5,drawgrid=width=100:height=100:thickness=2:color=white,perspective=eval=frame:x0='200-(200*t/5)':y0='200-(200*t/5)':x1=1600:y1=0:x2='200-(200*t/5)':y2='700+(200*t/5)':x3=1600:y3=900[skew]" -an -map [skew] skew.mp4
这就是问题发生的地方。我收到一条错误消息 [Eval @ 000000f36ebfebf0] Undefined constant or missing '(' in 't/5)' Error while filtering: Invalid argument
perspective docs说它应该与 eval=frame
一起使用选项。有人有什么想法吗?这看起来像ffmpeg中的错误吗?我正在使用最新版本 4.3.2。
最佳答案
正如文档所说,
The expressions can use the following variables:
W
H
the width and height of video frame.
in
Input frame count.
on
Output frame count.
t
不是允许的变量之一。使用in
在哪里 in
是表示时间 x fps 的整数。我可以增加时间,但给我几天时间来插入它。
关于ffmpeg透视滤镜动画错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66678485/