Can ffmpeg convert audio to raw PCM? If so, how?
118,778
Solution 1
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
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
Related videos on Youtube
Author by
David van Geest
Updated on July 05, 2022Comments
-
David van Geest 11 monthsI'm currently using
ffmpegto convertFLV/SpeextoWAV/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.rawBut ffmpeg responds with:
Unable to find a suitable output format for 'output.raw'I also tried using
output.pcmandoutputas output file names, with the same result.I also tried the
-fflag to specify raw format, but that gives:Unknown input or output format: rawIs this possible with FFmpeg? If so, how?
-
rogerdpack almost 11 yearsfor followers, ffmpeg -i lame1.mp3 -acodec pcm_s16le yo.wav converts it to wav with the WAV headers. -
Arto Bendiken over 5 yearsFor those stuck onUnable 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-iargument here as the first argument. -
Hashim Aziz about 4 yearsFor me putting-f s16leafter the codec was what worked. -
Freedo almost 4 yearsIf I add-map 0:ato 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? -
bballdave025 over 2 yearsI appreciate the time you took to explain the parameter meanings. It allowed me to do what I needed to do.