FOLLOW US
4dots Software CODE BLOG

How to make blur video transition effect with ffmpeg

To make a blur video transition effect with ffmpeg use the following code :

	
ffmpeg.exe -loop 1 -t effectDurationInSeconds -i firstImage.jpg -loop 1 -t effectDurationInSeconds -i secondImage.jpg 
-loop 1 -t stayDurationInSeconds -i firstImage.jpg -loop 1 -t stayDurationInSeconds -i secondImage.jpg
-filter_complex
"color=black:d=3,scale=imageWidthximageHeight[b];[0:v]boxblur=lp=4[a1];[0:v]boxblur=lp=24[a2];
[0:v]boxblur=lp=44[a3];[0:v]boxblur=lp=64[a4];[0:v]boxblur=lp=84[a5];[0:v]boxblur=lp=104[a6];
[b][a1]overlay=enable='if(between(n,0,12),1,0)'[t1];[t1][a2]overlay=enable='if(between(n,12,24),1,0)'
[t2];[t2][a3]overlay=enable='if(between(n,24,36),1,0)'[t3];[t3][a4]overlay=enable='if(between(n,36,48),1,0)'
[t4];[t4][a5]overlay=enable='if(between(n,48,56),1,0)'[t5];[t5][a6]overlay=enable='if(between(n,56,60000),1,0)'
[t7];color=black:d=3,scale=imageWidthximageHeight[ba];[1:v]boxblur=lp=104[aa1];[1:v]
boxblur=lp=84[aa2];[1:v]boxblur=lp=64[aa3];[1:v]boxblur=lp=44[aa4];[1:v]boxblur=lp=24[aa5];
[1:v]boxblur=lp=4[aa6];[ba][aa1]overlay=enable='if(between(n,0,12),1,0)'[ta1];[ta1][aa2]
overlay=enable='if(between(n,12,24),1,0)'[ta2];[ta2][aa3]overlay=enable='if(between(n,24,36),1,0)'
[ta3];[ta3][aa4]overlay=enable='if(between(n,36,48),1,0)'[ta4];[ta4][aa5]overlay=enable='
if(between(n,48,56),1,0)'[ta5];[ta5][aa6]overlay=enable='if(between(n,56,60000),1,0)'[ta7];
[t7]fade=t=out:st=0:d=3:alpha=1[v1];[ta7]fade=t=in:st=0:d=3:alpha=1[v2];[v1][v2]overlay[v3];
[2:v][v3][3:v]concat=n=3:v=1:a=0[v]" -map "[v]" outvideo.mp4

effectDurationInSeconds : how long the video transition should last in seconds.

stayDurationInSeconds : how long the image should stay in seconds.

imageWidth, imageHeight : image width and height.


 

Please Donate!