SoX doesn't work with Opus Audio files

ryancey picture ryancey · Mar 11, 2014 · Viewed 8.1k times · Source

I am recording input microphone from a web page with WebRTC and process it through SoX.

Problem is, Firefox recordings are in Opus Audio format (according to VLC media informations), in an Ogg container, and SoX doesn't like it : /opt/local/bin/sox FAIL formats: can't open input file `/Users/[...]/public/audio/7a0d13a501.ogg': Input not an Ogg Vorbis audio stream

Is there a way to make it work with SoX? Or should I use another command-line audio tool?

Answer

ryancey picture ryancey · Mar 13, 2014

I ended up doing this (either works, don't know which is the fastest):

opusdec --force-wav file.ogg - | sox - file.mp3

or

sox "|opusdec --force-wav file.ogg -" file.mp3