2017-09-21 113 views
0

我一直在努力通过FFmpeg,但我一直无法得到他们的网站上的示例运行旋转。我试图在底部的一个固定点上来回摆动视频 - 想想一个从左向右移动的头(等等)。FFmpeg - 在角度旋转

我正在尝试使用过滤器“rotate”(https://ffmpeg.org/ffmpeg-filters.html#rotate)来做到这一点。试图使用他们的例子,我得到一个错误。

这是我到目前为止有:

ffmpeg -i vid1.mp4 -i vid2.mov -loop 1 -i image.png -filter_complex "\ 
    [2:v]alphaextract, scale=240x160[mask];\ 
    [0:v] scale=240x160, rotate=A*sin(2*PI/T*t) [ascaled];\ 
    [ascaled][mask]alphamerge[masked];\ 
    [1:v]scale=480x360[background];\ 
    [background][masked]overlay=120:20"\ 
    -c:a copy 65B6354F61B4AF02_HD_sq.MOV 

我使用的一个例子,企图得到的东西在所有运行“旋转”直接。

的错误我得到的回复是:

[Parsed_rotate_3 @ 0x7ff4476045e0] [Eval @ 0x7fff5b3e3f00] Undefined constant or missing '(' in 'T*t)' 
[Parsed_rotate_3 @ 0x7ff4476045e0] Error occurred parsing angle expression 'A*sin(2*PI/T*t)' 
[Parsed_rotate_3 @ 0x7ff4476045e0] Failed to configure output pad on Parsed_rotate_3 
Error reinitializing filters! 
Failed to inject frame into filter network: Invalid argument 
Error while processing the decoded data for stream #1:0 

如果我删除“A”,“T”,“罪”等,不旋转实际的工作,但是从所期望的行为为止。

我是否缺少某些东西来揭露那些参数?

回答

1

在该表达式中,

rotate=A*sin(2*PI/T*t) 

AT不是文字。用户的目的是用数字代替它们,代表以弧度为单位的振幅和以秒为单位的分辨率。

例如

rotate=2*sin(2*PI/3*t) 
+0

非常感谢,非常有帮助。 – connor

0

给一个尝试到transpose过滤器,例如,旋转90顺时针

ffmpeg -i input.mp4 -vf "transpose=1" output.mp4 

对于转置参数可以传递:

0 90CounterCLockwise and Vertical Flip (default) 
1 90Clockwise 
2 90CounterClockwise 
3 90Clockwise and Vertical Flip 
+0

我不是真的要在一个方向上完全翻转。我试图做一些从左到右(等)的运动,以一个角度旋转。 – connor

+0

检查https://superuser.com/a/578329/284722希望它有帮助 – nbari