Search code examples
audioffmpegwavsoxavconv

not able to convert a specific .wav file to mp3 or m4a with sox, avconv


At the office we have a project where we apply IoT technologies to a real bee hive.

One of the features is to detect specific sounds the bees make when a new queen hatches. We have a special microphone in place, the algorithm is also implemented. For now we get a lot of false positives, and want to quickly be able to identify them, by listening to the audio files in the browser. Therefore I want to convert the .wav files to either .mp3 or .m4a

The .wav file format seems to be quite strange, as I was not able to convert it to mp3 using avconv, sox or even audacity. The funny thing is, the Microsoft media player can play the .wav file fine.

Here is the information soxi gives about the wav file:

pi@raspberrypi:~ $ soxi Channel1.wav
soxi WARN wav: wave header missing extended part of fmt chunk

Input File     : 'Channel1.wav'
Channels       : 1
Sample Rate    : 6250
Precision      : 24-bit
Duration       : 00:01:21.00 = 506250 samples ~ 6075 CDDA sectors
File Size      : 2.03M
Bit Rate       : 200k
Sample Encoding: 32-bit Floating Point PCM

This is the avconv command I am trying to use:

avconv -y -v quiet -i Channel1.wav -strict experimental -ar 44100 -ab 160k Channel1.m4a

I also tried with sox:

sox  -v 0.60 Channel1.wav -r 22050 Channel1.m4a

but the output is mostly silent, with some random noise.

The question is how can a wav file like this: https://drive.google.com/open?id=0B9YVh-jkOMLsQThERlI2emN2QWM be converted to an audio format using a raspberry pi that can be played in the browser?


Solution

  • Upgrade to a current build of ffmpeg.

    The command below produces an undistorted file - checked in Firefox and Chrome.

    ffmpeg -i Channel1.wav -ar 44100 out.m4a