videoffmpegvideo-processingfading

ffmpeg: Audio/Video Fade in/out


I have this working Script with Audio fading. How can i input also a Fading for the video in and out. It always gives me an error :

"Option filter:v (set stream filtergraph) cannot be applied to input url ./mp3/conv/1.m4a -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to."

This Works with audio-fading:

 ffmpeg  -ss 00:00:00 -t 90 -i "concat:intermediate0.ts|concat:intermediate1.ts"  
-i "./mp3/conv/1.m4a" -af "afade=t=out:st=84:d=6"  -map 0:v:0 -map 1:a:0 
video/out515.mp4 -y

This doesn't Work with Audio+Video-Fading:

ffmpeg  -ss 00:00:00 -t 90-i  "concat:intermediate0.ts|intermediate1.ts" 
-filter:v 'fade=in:0:30,fade=out:250:30' -i "./mp3/conv/1.m4a" 
-af "afade=t=out:st=84:d=6" -map 0:v:0 -map 1:a:0  video/out515.mp4 -y

Solution

  • Video filters are output options, and so, go after all inputs:

    ffmpeg  -ss 00:00:00 -t 90-i  "concat:intermediate0.ts|intermediate1.ts" -i "./mp3/conv/1.m4a" 
            -af "afade=t=out:st=84:d=6" -vf 'fade=in:0:30,fade=out:250:30'
            -map 0:v:0 -map 1:a:0  video/out515.mp4 -y