mercredi 21 janvier 2015

FFmpeg: How can I crossfade 2 clips with video and audio?

I'm trying to crossfade 2 videos (93 seconds and 30 seconds) using ffmpeg. I've managed to crossfade the video succesfuly using this command line:


ffmpeg -i 01.mp4 -i 02.mp4 -f lavfi -i color=black -filter_complex "[0:v]format=pix_fmts=yuva420p,fade=t=out:st=92:d=1:alpha=1,setpts=PTS-STARTPTS[va0];[1:v]format=pix_fmts=yuva420p,fade=t=in:st=0:d=1:alpha=1,setpts=PTS-STARTPTS+92/TB[va1];[2:v]scale=640x360,trim=duration=121[over];[over][va0]overlay[over1];[over1][va1]overlay=format=yuv420[outv]" -aspect 16:9 -vcodec libx264 -acodec libvo_aacenc -ar 44100 -b:a 76k -map [outv] out.mp4


However, when I try to crossfade video + audio, both audio tracks start together and the video stops after the first one:


ffmpeg -i 01.mp4 -i 02.mp4 -f lavfi -i color=black -filter_complex "[0:v]format=pix_fmts=yuva420p,fade=t=out:st=92:d=1:alpha=1,setpts=PTS-STARTPTS[va0];[0:a]afade=out:st=92:d=1[a1];[1:v]format=pix_fmts=yuva420p,fade=t=in:st=0:d=1:alpha=1,setpts=PTS-STARTPTS+92/TB[va1];[1:a]afade=in:st=0:d=1;[2:v]scale=640x360,trim=duration=121[over];[over][va0]overlay[over1];[over1][va1]overlay=format=yuv420[outv]; [a1][a2]amix=inputs=2,volume=2" -aspect 16:9 -vcodec libx264 -acodec libvo_aacenc -ar 44100 -b:a 76k -map [outv] out.mp4


I cannot find the error. Thanks in advance!


Aucun commentaire:

Enregistrer un commentaire