How to use ffmpeg to fade in/out a veriable frame rate video clip with unknown duration
This works here

ffmpeg -i VID_1.mp4 -sseof -2 -copyts -i VID_1.mp4 -lavfi "[1]fade=out:s=1:d=2[tail];[0][tail]overlay,fade=in:s=0:d=2,scale=640:-2[video];anullsrc,atrim=0:2.1[audiotail];[0][audiotail]acrossfade=d=2,afade=d=2[audio]" -map "[video]" -map "[audio]" -vsync 2 -sws_flags gauss -c:v libx264 -crf 18 -preset slow -shortest -report VID_1_out.mp4


With some videos, usually those with variable FPS, the fade filter only works with start frame as non-zero. Also, the anullsrc needs to be only slightly greater than the crossfade duration.