Can ffmpeg convert audio from raw PCM to WAV?

The wav container just adds a simple header to the raw PCM data. The header includes the format, sample rate, and number of channels. Since the raw PCM data does not include this information, you will need to specify it on the command line. Options are specified before the file they apply to, so options before the input file may be used to specify the format of the input file, and options after the input file and before the output file may be used to specify the desired format of the output file. If you want the same bits/sample, sample rate, and number of channels in the output file then you don’t need any output options in this case; the wav container format is already indicated by the file extension.

Example to convert raw PCM to WAV:

ffmpeg -f s16le -ar 44.1k -ac 2 -i file.pcm file.wav
  • -f s16le … signed 16-bit little endian samples
  • -ar 44.1k … sample rate 44.1kHz
  • -ac 2 … 2 channels (stereo)
  • -i file.pcm … input file
  • file.wav … output file

Leave a Comment