How to compress voice recordings with Opus attachment
mouse 101 · person cloud · link
Last update
2018-11-27
2018
11-27
«compress uncommon wav to opus»

There are various audio recorders on the market, you could have stumbled upon one of these or something similar:

Name, model Specs Notes
Victure, X5 8GB, 12h,
510mAh
stylish and solid (glass+metal)
Elegiant, CupGtdQWy 8GB, 16h bulky and simple design with very long recording time
Pendrive recorder 8GB very cheap, fragile, buggy, small battery, decent recordind time


some of them can record directly in MP3 format but this depletes the battery faster than the WAV one.

Using the WAV format produces a file not suitable as input of our beloved tools like lame, oggenc or opusenc, we can use mplayer to convert it to a suported format:

1
2
3
4
5
6
7
apt install mplayer opus-tools

# convert WAV file to a supported format
mplayer -vo null -vc null -ao pcm:fast:file=in_ok.wav in.wav

# compress the converted WAV file in OPUS
opusenc --bitrate 24 in_ok.wav out.opus

you can use the attached recorder2opus.rb script that uses a named pipe file to avoid the creation of the converted WAV file.

Using the Victure X5 recorder with the lowest WAV quality I made some compression tests in MP3, OGG and OPUS and these are the results:

  • File size at the same bitrate: MP3 > OGG > OPUS. So OPUS is the winner.
  • A meaningful bandpass range for voice recordings is about 11kHz so we should use an OPUS bitrate between 24-28Kb/s (see reccommended settings). The audio quality remains high in the range 20-28Kb/s but below the 24Kb/s the file size increases. So 24Kb/s is the winner.
  • Trying to downmix to MONO always gave a bigger file. So it is better to keep it STEREO.

Reference: xiph.org, Vorbis, Opus & Opus FAQ, Lame encoder, Mplayer