How do I fade in and out in FFmpeg?
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 &#39;,&#39; 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:


Filtering always require re-encoding.
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