When things go wrong your video is basically unplayable or the first video plays fine and then freezes when moving on to the next. Generally if both videos weren't produced with the exact 100% same settings you will have issues. You can try the basic concat but it often won't work right.
Solution for me:
My example uses 3 videos in total so "n=3" and a=1 to include audio.
ffmpeg -threads 12 -i file1.mp4 -........
#if you have nvidia make sure you install the nvidia-cuda-toolkit so hardware acceleration can be used
tar -jxvf ffmpeg-3.3.2.tar.bz2
install prefix /usr/local
source path ........