ffmpeg is a very powerful tools, as it is a general tool for audio/video encoding and decoding as well as ripper, converter and even provided API for programmers. I came across a tutorial uses ffmpeg libs for writting a video player less than 1000 lines of codes, which is cool.
I have one time needed to convert a wave file from one encoding format to another because the stream servers at mobile back-end switch only plays wav with a-law encoding format. I have no idea what format is a-law (an ITU standards encoding audio format) at first, and it doesn’t matter. First check the wav file’s encoding info with command call file.
The outcomes is this:
amazing_grace.wav: RIFF (little-endian) data, WAVE audio, ITU G.711 A-law, mono 8000 Hz
The target wav must be in this format. So, first of all I would like to check whether is it support a-law encoding?
Bare in mind, encoder and decoder is not always come in pair, ffmpeg may sometimes only support for decoding but not encoding.
D - Decoder, E - Encoder and A is audio. Apparently it does support for a-law. So, let us convert it with ffmpeg.
ffmpeg -i imaging.wav -acodec pcm_alaw -ar 8000 imaging1.wav
-i is input file, -ar is audio rate in Hz. Just a slides of time, and you are done. And good thing about command line is you can put that into a bash script to do a batch converts.