ffmpeg crossfading multiple images

2

I am trying to cross-fade multiple images. I found some helpful piece of code in this superuser thread. So far I am stuck at this point:

ffmpeg -loop 1 -i img0.jpg -loop 1 -i img1.jpg -i img2.jpg -f lavfi -i color=black \
-filter_complex "\
[0:v]scale=480x320,format=pix_fmts=yuva420p,fade=t=out:st=3:d=0.25:alpha=1[va0]; \
[1:v]scale=480x320,format=pix_fmts=yuva420p,fade=t=in:st=3:d=0.25:alpha=1,fade=t=out:st=6:d=0.25:alpha=1[va1]; \
[2:v]scale=480x320,format=pix_fmts=yuva420p,fade=t=in:st=6:d=0.25:alpha=1[va2]; \
[3:v]scale=480x320,trim=duration=9[over0];\
[over0][va0]overlay[over1]; \
[over1][va1]overlay=format=yuv420[over2]; \
[over2][va2]overlay=format=yuv420[outv]" \
-c:v libx264 -map [outv] -y -t 9 outcross.mp4

After the 2nd clip it fades to black. It seem to have missed something.

I am still a newbie to FFmpeg so I am not too familiar on doing multiple operations.

nik1337

Posted 2015-07-09T12:23:58.867

Reputation: 21

actually charmath your edit is probably fine I just couldn't see that you had preserved the link http://i.imgur.com/efGcfSk.png 'cos it was just showing in green rather than blue in this screen

– barlop – 2015-07-09T13:54:23.797

@barlop I'm sorry... this appears to be fine here... blue link. – Chamath – 2015-07-09T14:43:25.460

Thanks for the edits, I wasn't aware! And thanks for the hint! – nik1337 – 2015-07-09T15:21:56.250

@Chamath just made it bold and blue, that's clearer – barlop – 2015-07-09T18:13:33.273

Answers

0

You have missed a -loop 1 for the third image.

ffmpeg -loop 1 -i img0.jpg -loop 1 -i img1.jpg -loop 1 -i img2.jpg -f lavfi -i color=black -filter_complex "\
[0:v]scale=480x320,format=pix_fmts=yuva420p,fade=t=out:st=3:d=0.25:alpha=1[va0]; \
[1:v]scale=480x320,format=pix_fmts=yuva420p,fade=t=in:st=3:d=0.25:alpha=1,fade=t=out:st=6:d=0.25:alpha=1[va1]; \
[2:v]scale=480x320,format=pix_fmts=yuva420p,fade=t=in:st=6:d=0.25:alpha=1[va2]; \
[3:v]scale=480x320,trim=duration=9[over0];\
[over0][va0]overlay[over1]; \
[over1][va1]overlay=format=yuv420[over2]; \
[over2][va2]overlay=format=yuv420[outv]" -c:v libx264 -map [outv] -y -t 9 outcross.mp4

Also see here for a different approach.

Chamath

Posted 2015-07-09T12:23:58.867

Reputation: 412

-1

Michael

Posted 2015-07-09T12:23:58.867

Reputation: 63

Welcome to Super User! On this Q&A site we try to provide good answers to questions people post. A part of this is including the answer in your post, instead of simply providing a link to another page that might answer the question. Please edit your answer to include the actual solution to the posted question. Refer to How to reference material written by others for help.

– cascer1 – 2016-11-15T10:33:16.663