10

I have an MP4 file which I am looking to convert to WAV file, containing signed 16-bit PCM samples. I have ffmpeg at my disposal, and looking at previous SOF posts, I have tried:

ffmpeg -y  -i input.mp4  -acodec pcm_s16le -f s16le -ac 1 -ar 16000 output.pcm

but, the program I use complains that this converted file has data in unknown format. I was wondering if anyone had any pointers on how to go from m4a to wav with pcm samples.

icedwater
  • 4,701
  • 3
  • 35
  • 50
JohnJ
  • 6,736
  • 13
  • 49
  • 82

1 Answers1

18
ffmpeg -i input.mp4 output.wav

This command will output WAV file containing signed 16-bit PCM samples. Your command is outputting raw PCM, not WAV.

You can add -c:a pcm_s16le output option if you prefer, but that's the default encoder for WAV so it can be omitted.

llogan
  • 121,796
  • 28
  • 232
  • 243
  • 1
    To be sure the sample rate of the output is 16k use `ffmpeg -i input.mp4 -ar 16000 output.wav`. – albus_c Apr 06 '21 at 17:56
  • question is about m4a file and not mp4 . is it the same thing? – Raulp Mar 29 '23 at 06:44
  • 1
    @Raulp the OP is a bit ambiguous there :) The confusion comes from the fact that "m4a" is an _audio_ file (in the Mac world, the audio is usually encoded with AAC [lossy] or ALAC [lossless], but it's not mandatory) using a MPEG-4 _container_. MPEG-4 is a standard container format that can use audio, video, still images, or even all of those together. So, when the OP talks about "m4a", he very likely means "an audio file inside a MPEG-4 container". Why use MPEG-4 and not the more common MPEG-3 audio-only format? Well, MPEG-4 allows much better compression and higher-quality sound/video... – Gwyneth Llewelyn Jun 13 '23 at 23:05