I'm trying to overlay several images over an existing video, with the first image coming in with a fade-in effect. But instead I'm getting a black rectangle in place of the picture. But if I skip the fade-in and just put [img0]
after decrease like so decrease[img0]
then it works (but without fade in)
please advise. TY
-y
-i "G:\...\Videos\BLANK.mp4"
-i "G:\...\Front\1.jpg"
-i "G:\...\Front\2.jpg"
-i "G:\...\Front\3.jpg"
-i "G:\...\Front\4.jpg"
-i "G:\...\Front\5.jpg"
-i "G:\...\Front\6.jpg"
-filter_complex [1:v]scale=880:545:force_original_aspect_ratio=decrease,fade=t=in:st=2.6:d=1[img0];
[0:v][img0]overlay=x='if(lte(2.6-t,0),450,NAN)':y='if(lte(2.6-t,0),5,NAN)':enable='between(t,2.6,4)'[v0];
[2:v]scale=880:545:force_original_aspect_ratio=decrease[img1];
[v0][img1]overlay=x='if(lte(4-t,0),450,NAN)':y='if(lte(4-t,0),5,NAN)':enable='between(t,4,5.6)'[v1];
[3:v]scale=880:545:force_original_aspect_ratio=decrease[img2];
[v1][img2]overlay=x='if(lte(5.6-t,0),450,NAN)':y='if(lte(5.6-t,0),5,NAN)':enable='between(t,5.6,6.3)'[v2];
[4:v]scale=880:545:force_original_aspect_ratio=decrease[img3];
[v2][img3]overlay=x='if(lte(6.3-t,0),450,NAN)':y='if(lte(6.3-t,0),5,NAN)':enable='between(t,6.3,6.9)'[v3];
[5:v]scale=880:545:force_original_aspect_ratio=decrease[img4];
[v3][img4]overlay=x='if(lte(6.9-t,0),450,NAN)':y='if(lte(6.9-t,0),5,NAN)':enable='between(t,6.9,7.4)'[v4];
[6:v]scale=880:545:force_original_aspect_ratio=decrease[img5];
[v4][img5]overlay=x='if(lte(7.4-t,0),450,NAN)':y='if(lte(7.4-t,0),5,NAN)':enable='between(t,7.4,7.9)'[v5];
-map [v5] -map 0:a -c:v libx264 -c:a copy "G:\...\Videos\ffmpeg\output.mp4"
Multiple issues prevent your command from resulting in that outcome.
A single image file represents a video stream of 1 frame whereas fade requires a sequence of frames for the animation to occur.
Fade, by default, alters the color of the input. Whereas you need to animate the transparency (known as the alpha). JPEGs don't come with these, so we need to add alpha. And then tell fade to work on the alpha.
So add -loop 1 -t 3.6
before -i "G:\...\Front\1.jpg"
where 3.6 is the time for fade in to complete.
Then the initial filter will be,
[1:v]format=yuva444p,scale=880:545:force_original_aspect_ratio=decrease,fade=t=in:st=2.6:d=1:alpha=1[img0];