Skip to content

Instantly share code, notes, and snippets.

@michaelwills
Last active February 23, 2016 09:28
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 michaelwills/de3d2296110c40ecb80f to your computer and use it in GitHub Desktop.
Save michaelwills/de3d2296110c40ecb80f to your computer and use it in GitHub Desktop.
sphinx 4 audio preparation snippets
# use ffmpeg to extract audio from video file
% ffmpeg -i infile.mp4 -acodec pcm_s16le -ac 1 -ar 16000 outfile.wav
# use sox to convert to raw
sox infile.wav -b 16 -s -c 1 -r 16k -t raw outfile.raw
# https://trac.ffmpeg.org/wiki/audio%20types
# use ffmpeg to extract RAW! audio from video file
ffmpeg -i input -f s16le -acodec pcm_s16le output.raw
% ffmpeg -i infile.mp4 -f s16le -acodec pcm_s16le -ac 1 -ar 16000 outfile.raw
#doh! so simple! But that `-f s16le` looks like it is needed
# http://stackoverflow.com/questions/4854513/can-ffmpeg-convert-audio-to-raw-pcm-if-so-how
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment