0

I am using ffmpeg for image overlay.

I have multiple images, which I wanted to overlay. My below code workd great for this.

ffmpeg -i D:/Test.mp4 
-i D:\Images\test.jpg 
-i D:\Images\test2.jpg 

-filter_complex  "[0][1]overlay=x=0:y=0:enable='between(t,1237.216831,1837.216831)'[v1];
[v1][2]overlay=x=0:y=0:enable='between(t,2237.216831,2469.729935)'[v2]"

 -map "[v2]" -map 0:a
 D:\ffmpeg_output\output.mp4

Now, I wanted to bring different effects at the time of image overlay. I learnt give effects using code

xfade=transition=fade:duration=0.5:offset=408.84

How do I apply transitions in my overlay image code together?

Please guide.

Kind Regards,

2
  • Not sure what you are trying to do. xfade is used to transition 2 inputs: one right after the other. Like a crossfade. But your 2 overlays have a gap in the timestamps between them. How should a transition occur between 2 videos that are temporally non-contiguous? – llogan Jun 10 at 16:55
  • Got your point and understood on xfade side. Basically, On my video, I wanted that entire Video should be overlayed for certain time and that is happening great. But the image which comes, I wanted that image should have some effects while coming. Image should not come all of sudden. So, I was trying to bring and put all different type of effects which we have in xfade. How can I bring effects for images? Please advise. – D.B. Jun 10 at 19:38
1

Give alpha channel to each image with the format filter, then add the fade filter:

ffmpeg -i video.mp4 -loop 1 -i image1.jpg -loop 1 -i image2.jpg 
-filter_complex "[1]format=yuva444p,fade=t=in:st=2237.216831:d=1:alpha=1[img1];[2]format=yuva444p,fade=t=in:st=2237.216831:d=1:alpha=1[img2];[0][img1]overlay=x=0:y=0:format=auto:enable='between(t,2237.216831,2469.729935)':shortest=1[bg];[bg][img2]overlay=x=0:y=0:format=auto:enable='between(t,2237.216831,2469.729935)':shortest=1,format=yuv420p"
-c:a copy output.mp4
1
  • Many Many thanks for your great support. Salute to you. – D.B. 2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.