FFmpeg

Difference between file extensions wav, opus, m4a etc.

ffmpeg -i file1.m4a -ar 16000 -b:a 32000 -ac 1 file1.opus

ffmpeg -i file2.opus -ar 16000 -ac 1 file2.wav

if we need a mono channel we use ac -1 flag

if we need 16kHz we use -ar 16000 flag

will compress file using -b:a 32000 flag

ffmpeg -help
-ab bitrate         audio bitrate (please use -b:a)
-ar rate            set audio sampling rate (in Hz)
-ac channels        set number of audio channels

-ar is the frequency at which the amplitude is measured e.g. 16kHz. it measures the amplitude 16k times a second.

-ab the bitrate is about how that information is compressed, it's an approximate num-bits per second. that it tries to compress the information to.

It is my understanding that if we want to compress the file we will use -ab flag when using ffmpeg

If we need decompress then we need to use -ar flag when using ffmpeg


This table shows how file sizes can change depending what extension we need.

file m4a sizeopus size wav size 
file114M1.3M28M
file211M2.6M21M
file38.1M1.8M16M

ffmpeg -i f.opus  -f wav -ar 16000 -ac 1 - > res.wav

ffmpeg -i f.opus  -f wav -ar 16000 -ac 1 - |

Comments