87

I'm currently using ffmpeg to convert FLV/Speex to WAV/pcm_s16le, successfully. However, I now need the output format to be RAW, that is, PCM signed 16-bit little endian, without the WAV header. I tried the following:

ffmpeg -y -i input.flv -vn -acodec pcm_s16le output.raw

But ffmpeg responds with:

Unable to find a suitable output format for 'output.raw'

I also tried using output.pcm and output as output file names, with the same result.

I also tried the -f flag to specify raw format, but that gives:

Unknown input or output format: raw

Is this possible with FFmpeg? If so, how?

Dmitrii Sidenko
  • 660
  • 6
  • 19
David van Geest
  • 1,957
  • 1
  • 20
  • 19

2 Answers2

127

Give this a shot:

ffmpeg -i input.flv -f s16le -acodec pcm_s16le output.raw

You can get these options by running:

ffmpeg -formats

See https://trac.ffmpeg.org/wiki/audio%20types for details

rogerdpack
  • 62,887
  • 36
  • 269
  • 388
Chris Haas
  • 53,986
  • 12
  • 141
  • 274
  • 23
    for followers, ffmpeg -i lame1.mp3 -acodec pcm_s16le yo.wav converts it to wav *with* the WAV headers. – rogerdpack Aug 16 '12 at 14:54
  • 2
    For those stuck on `Unable to find a suitable output format for 'output.raw'`, note that the order of arguments is significant for FFmpeg, and hence you must keep the `-i` argument here as the first argument. – Arto Bendiken Nov 30 '17 at 12:29
  • 1
    For me putting `-f s16le` after the codec was what worked. – Hashim Aziz Feb 27 '19 at 00:00
  • If I add `-map 0:a` to encode all audios from input and change it to mkv, it gives a error... what would be the command to encode all audio tracks from input to pcm? – Freedo Jun 03 '19 at 09:52
41

convert mp4 file to pcm

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

you can also use it to convert mp3 to pcm

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

key params means:

-f s16le … PCM signed 16-bit little-endian samples

-ac 1 … 1 channel (mono)

-ar 16000 … sample rate 16000Hz
Dmitrii Sidenko
  • 660
  • 6
  • 19
Jayhello
  • 5,931
  • 3
  • 49
  • 56