2017-09-21 30 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