Concatenate multiple WAV files using single command, without extra file

You could try using the concat filter; it requires re-encoding, and so will take more system resources (a pretty tiny amount on any vaguely modern computer in this particular case), but PCM -> PCM audio should be mathematically lossless. In your case, you would use something like:

ffmpeg -i input1.wav -i input2.wav -i input3.wav -i input4.wav \
-filter_complex '[0:0][1:0][2:0][3:0]concat=n=4:v=0:a=1[out]' \
-map '[out]' output.wav

If you have five input files, use n=5.


I think the best option for wav is to use sox, not ffmpeg:

$ sox short1.wav short2.wav short3.wav long.wav

Solution comes from How do I append a bunch of .wav files while retaining (not-zero-padded) numeric ordering?


The FFmpeg wiki mentions using the concat protocol is not possible with all file types. It works fine with most MPEG containers and bitstreams, but obviously not WAV files with PCM audio.

You don't necessarily have to create a temporary file and use that. With Bash (or other shells that support process substitution), you can do everything in a single command:

ffmpeg -f concat -i <( for f in *.wav; do echo "file '$(pwd)/$f'"; done ) output.wav

The process substitution <( ) creates a file—or, to be precise, a file descriptor—on the fly, which ffmpeg can read. This file will contain the path to every .wav file in the current directory. We have to prefix it with $(pwd) to get the correct path relative to your current directory, and not relative to the file descriptor.

Of course, the command within the substitution can be changed to something else.