Can ffmpeg convert audio to raw PCM? If so, how?

FfmpegFlvPcm

Ffmpeg Problem Overview


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?

Ffmpeg Solutions


Solution 1 - Ffmpeg

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

Solution 2 - Ffmpeg

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDavid van GeestView Question on Stackoverflow
Solution 1 - FfmpegChris HaasView Answer on Stackoverflow
Solution 2 - FfmpegJayhelloView Answer on Stackoverflow