Difference between file extensions wav, opus, m4a etc.
ffmpeg -i file1.m4a -ar 16000 -b:a 32000 -ac 1 file1.opusffmpeg -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 size | opus size | wav size |
| file1 | 14M | 1.3M | 28M |
| file2 | 11M | 2.6M | 21M |
| file3 | 8.1M | 1.8M | 16M |
ffmpeg -i f.opus -f wav -ar 16000 -ac 1 - > res.wav
ffmpeg -i f.opus -f wav -ar 16000 -ac 1 - |
Comments
Post a Comment