Fade both video & audio
First of all, the command you've provided won't achieve the desired effect: the fade filter only applies to a video stream, plus you specifically apply it to your input video stream with -filter:v.
To fade both audio and video, you'll need both afade and fade filters.
E.g.
ffmpeg -i input.mp4 -filter:v "fade=in:0:30, fade=out:1770:30" -filter:a "afade=in:0:44100, afade=out:2601900:44100" -c:v libx264 -c:a aac output.mp4 This command fades in and out the first and last 30 video frames and 44100 audio samples, on a 1800 frames-long and 2646000 samples-long video (which, if your framerate is 30 fps and samplerate 44100 Hz, will be the first and last second of your 60 seconds-long clip).
Working with frames and samples can be highly impractical, so to work with start and duration in seconds, use the st (start) and d (duration) parameters, like so :
ffmpeg -i input.mp4 -filter:v "fade=in:st=0:d=1, fade=out:st=59:d=1" -filter:a "afade=in:st=0:d=1, afade=out:st=59:d=1" -c:v libx264 -c:a aac output.mp4 (fades in and out first and last second of a 60s clip)
See afade and fade filters documentation for more details on parameters.
Alternatively, you can also use a complex filtergraph as suggested by Manul Hüttinger, which can be handy if you need to apply further filters to your clip:
ffmpeg -i input.mp4 -filter_complex \ "fade=in:st=0:d=1, fade=out:st=59:d=1; \ afade=in:st=0:d=1, afade=out:st=59:d=1" \ -c:v libx264 -c:a aac output.mp4 Regarding your particular error
I'm not sure where your error comes from, but you should try the following:
- firstFirst, update your ffmpeg: your libavfilter is in version 6.99.100, latest is at least 7.6.100
- I guess you're on Windows, given the filepath and build number. Beware that you cannot use simplesingle quotes (
') on Windows, you must use double-quotes ("). Looking at the console output, this might be the origin of your error:
[AVFilterGraph @ 0000000002d64580] No such filter: fade=in:0:30,fade=out:227:30'
- thenThen, if it keeps failing, try with a different input (the error message might indicate an encoding/decoding error:
Failed to inject frame into filter network: Invalid argument Error while processing the decoded data for stream #0:0 Conversion failed