Skip to content

Instantly share code, notes, and snippets.

@ozgurgul
Forked from vunb/ffmpeg-convert-mp3-to-wave
Created June 24, 2020 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozgurgul/23765d0025b0126bfb96bc0087371892 to your computer and use it in GitHub Desktop.
Save ozgurgul/23765d0025b0126bfb96bc0087371892 to your computer and use it in GitHub Desktop.
Convert mp3 to wave format using ffmpeg
ffmpeg -i input.mp3 -acodec pcm_s16le -ac 1 -ar 16000 output.wav
# To convert all mp3 files in a directory in Linux:
for f in *.mp3; do ffmpeg -i "$f" -acodec pcm_s16le -ac 1 -ar 16000 "${f%.mp3}.wav"; done
# Or Windows:
for /r %i in (*) do ffmpeg -i %i -acodec pcm_s16le -ac 1 -ar 16000 %i.wav
# You can see file information with file, ffmpeg, ffprobe, mediainfo among other utilities:
$ file hjl0bC.wav
hjl0bC.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 16000 Hz
$ ffmpeg -i hjl0bC.wav
[...]
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment