Search code examples
androidandroid-ffmpeg

Ffmeg add fade in / out transition between videos


I am using WritingMinds ffmpeg wrapper for Android.

I need to merge a list of videos and add a white fade in / out transition between takes.

I merge the videos using concat and pass the videos as a list as seen below.

String[] cmd = new String[]{"-f", "concat", "-safe", "0", "-i", listPath, "-c", "copy", outPath};

Is there a way to add transitions with the way I merge the videos ?


Solution

  • I managed using:

    cmd = new String[]{"-i", srcPath, "-vf", "fade=t=in:st=0:d=0.5:color=white,fade=t=out:st=" + fadeDuration + ":d=0.5:color=white", "-pix_fmt", "yuv420p", "-c:v", "libx264", "-preset", "ultrafast", "-acodec", "copy", outPath};
    

    This will add a fade in at the start and a fade out at the end. After I add the effect to every video I then merge them together.