0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ffmpegでgifを作って埋め込む

Posted at

はじめに

xfadesample4_1.gif

このように、埋め込むことができます。

コマンド:

ffmpeg -loop 1 -t 2 -i marinebubbles.png -loop 1 -t 8 -i marinebubbles_text.png -filter_complex "[0][1]xfade=transition=smoothright:duration=2:offset=0,format=yuv420p [2];[2][0] xfade=transition=smoothright:duration=2:offset=6,format=yuv420p [3]" -map [3] xfadesample4_1.gif

marinebubbles.png:

marinebubbles.png

marinebubbles_text.png:

marinebubbles_text.png

このように、あらかじめテキストが入った画像を別に作っておきます。
テキストが入った画像を作るには、あらかじめファイルを用意しておき...

marinebubbles.txt:

setup=_=>{createCanvas(w=640,w);background(w);
(h=blendMode)(DIFFERENCE);
stroke(5,3,2);for(f=0;f<=90;f++){for(i=0;i<=w;i++){n=noise(i/99,f);
line(i,2*w,i,200+f*6-240*n)}}noStroke();fill(96);h(SCREEN);
for(k=0;k<w;k++){circle(x=(u=random)(w),y=u(w),u(y/20))}}

次のコマンドで生成します(フォントファイルは別途用意します)

ffmpeg -i marinebubbles.png -filter_complex "drawtext=fontfile=KosugiMaru-Regular.ttf:fontsize=16:fontcolor=black:x=16:y=16:textfile=marinebubbles.txt:line_spacing=-4" -pix_fmt yuv420p marinebubbles_text.png

これらをクロスフェードでつなげると、あのgifになります。

おわりに

 ここまでお読みいただいてありがとうございました。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?