Concatenating using ffmpeg

Instead of specifying the input file this way:
ffmpeg -i inputfile.mp4 ...
generate a text file with this content:
file inputfile.mp4
file anotherinputfile.mp4
file thirdfile.mp4
and use this command instead:
ffmpeg -f concat -i textfile.txt ...
Important note: All the input files must use the same codec and settings.