1

I understand there is a module built in FFmpeg which allows you to fade your clips in and out, however, no one really explains how to use the module with your own input. How do I simply fade both the audio and video in and out without re-encoding? (If that's possible)

2 Answers 2

2

Fading in is no problem, because you start from the timestamp 0 (or from other known timestamp or frame number), e.g. use:

ffmpeg -i input.mp4 -vf fade=in:0:d=5 -af afade=in:0:d=5 output.mp4

for 5-second fading in from the start of your clip.

Ignore the error

Only '-vf fade=in:0:d=5' read, ignoring remaining -vf options: Use ',' to separate filters

— see the answer of the question FFmpeg read, ignoring remaining -vf options: Use ',' to separate filters.

For fading out you have to subtract the time of fading out — e.g. 5 s — from the total duration of video or audio (you may find it with FFprobe). You got for example the timestamp 600 - 5 = 595 (from your 10-minutes long clip). Then add filters for fading out into the previous command:

ffmpeg -i input.mp4 -vf fade=in:0:d=5,fade=out:595:d=5 -af afade=in:0:d=5,afade=out=595:5 output.mp4

Notes:

  1. Filtering always require re-encoding.
  2. As in and 0 are defaults, you may shorten the command to

    ffmpeg -i input.mp4 -vf fade=d=5,fade=out:595:d=5 -af afade=d=5,afade=out=595:5 output.mp4
    
0

You can not do fade out/in without reencoding.

2
  • Ah damn, how would I do with re-encoding?
    – ProTechXS
    Aug 14, 2019 at 17:24
  • @ProTechXS, You can't, technically impossible.
    – Mint
    Mar 20, 2022 at 3:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.