2017-08-24 67 views
1

我用貼別人的代碼由LordNeckbeard這裏:FFmpeg move overlay from one pixel coordinate to anotherFFmpeg的 - 從A點移動覆蓋到B到C到d

我修改了它一下這個:

ffmpeg -i 4632.mpg -i 4632.bmp -filter_complex "[0]scale=320:240[over]; 
    [1][over]overlay=enable='between=(t,0,50)':x=20+t*30:y=20+t*20" -s 
    1280:720 -c:a copy -y output.mpg 

我想爲了能夠限制移動,覆蓋層不會脫離屏幕。 如何在四個方向上移動縮放的剪輯疊加層,X & Y從原始位置開始並返回?

回答

1

這個逐步運動必須使用條件表達式的聯合來構造。每個單元的基本語法是

(origin + (destination - origin)*(t - start time)/duration) * between(t,start time,end time)

然後,所有單元被加在一起,像在下面的例子。

比方說,您想將剪輯從(ax,ay)移至(bx,by)(cx,cy)並返回(ax,ay)。讓我們保持每條腿10秒。

語法是overlay=x='(ax+(bx-ax)*(t-0)/10)*between(t,0,10)+(bx+(cx-bx)*(t-10)/10)*between(t,10,20)+(cx+(ax-cx)*(t-20)/10)*between(t,20,30)':y='(ay+(by-ay)*(t-0)/10)*between(t,0,10)+(by+(cy-by)*(t-10)/10)*between(t,10,20)+(cy+(ay-cy)*(t-20)/10)*between(t,20,30)'

+0

太棒了。這工作。非常感謝。 – techr

+0

我該如何平滑運動?我在Adobe Premiere上看到了類似的效果,並且與ffmpeg結果相比,動畫平穩移動。 – techr

+0

分享Premiere視頻。 – Mulvya

相關問題