0

"crossfade between 2 videos using ffmpeg"

In the above link I found a way to add fade between 2 videos, but losing the audio. How can I do the same without lose the audio?

This is the command line I'm currently using, which is working very well, just losing the audio:

ffmpeg -i in0.mp4 -i in1.mp4 -filter_complex "[0]fade=t=out:st=0:d=1:alpha=1,setpts=PTS-STARTPTS[va0];[1]fade=t=in:st=0:d=1:alpha=1,setpts=PTS-STARTPTS/TB[va1];[va0][va1]overlay[outv]" -map [outv] -crf 10 out.mp4
RLT
  • 3
  • 1
  • 3
  • 5
    Does this answer your question? [Crossfading Video AND Audio with ffmpeg](https://superuser.com/questions/880807/crossfading-video-and-audio-with-ffmpeg) – OrangeDog Jan 29 '21 at 12:29

1 Answers1

1

Use

ffmpeg -i in0.mp4 -i in1.mp4
    -filter_complex
        "[0]fade=t=out:st=0:d=1:alpha=1,setpts=PTS-STARTPTS[va0];
         [1]fade=t=in:st=0:d=1:alpha=1,setpts=PTS-STARTPTS[va1];
         [va0][va1]overlay[outv];
         [0][1]amix[outa]" -map [outv] -map "[outa]" -crf 10 out.mp4
Gyan
  • 34,439
  • 6
  • 56
  • 98