title: How can I process OPUS format with Librosa?
body: <p>I am trying to generate spectrograms by using Librosa. When I was working with the .wav format file it was working fine. But I changed the format to OPUS audio codec and tried to run the same file, it give me below error.</p>
  <pre><code>X, sample_rate = librosa.load('TESS emotion datasets opus/OAF_Fear/OAF_beg_fear.opus', res_type='kaiser_fast', duration = 2.5, sr = 22050*2, offset = 0.5)
  </code></pre>
  <p>Error generated:</p>
  <pre><code>RuntimeError                              Traceback (most recent call last)
  ~/anaconda3/lib/python3.6/site-packages/librosa/core/audio.py in load(path, sr, mono, offset, duration, dtype, res_type)
      145     try:
  --&gt; 146         with sf.SoundFile(path) as sf_desc:
      147             sr_native = sf_desc.samplerate
  
  ~/anaconda3/lib/python3.6/site-packages/soundfile.py in __init__(self, file, mode, samplerate, channels, subtype, endian, format, closefd)
      628                                          format, subtype, endian)
  --&gt; 629         self._file = self._open(file, mode_int, closefd)
      630         if set(mode).issuperset('r+') and self.seekable():
  
  ~/anaconda3/lib/python3.6/site-packages/soundfile.py in _open(self, file, mode_int, closefd)
     1183         _error_check(_snd.sf_error(file_ptr),
  -&gt; 1184                      &quot;Error opening {0!r}: &quot;.format(self.name))
     1185         if mode_int == _snd.SFM_WRITE:
  
  ~/anaconda3/lib/python3.6/site-packages/soundfile.py in _error_check(err, prefix)
     1356         err_str = _snd.sf_error_number(err)
  -&gt; 1357         raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
     1358 
  
  RuntimeError: Error opening 'TESS emotion datasets opus/OAF_Fear/OAF_beg_fear.opus': File contains data in an unimplemented format.
  
  During handling of the above exception, another exception occurred:
  
  NoBackendError                            Traceback (most recent call last)
  &lt;ipython-input-39-1372f02f676e&gt; in &lt;module&gt;()
  ----&gt; 1 X, sample_rate = librosa.load('TESS emotion datasets opus/OAF_Fear/OAF_beg_fear.opus', res_type='kaiser_fast', duration = 2.5, sr = 22050*2, offset = 0.5)
  
  ~/anaconda3/lib/python3.6/site-packages/librosa/core/audio.py in load(path, sr, mono, offset, duration, dtype, res_type)
      161         if isinstance(path, (str, pathlib.PurePath)):
      162             warnings.warn(&quot;PySoundFile failed. Trying audioread instead.&quot;)
  --&gt; 163             y, sr_native = __audioread_load(path, offset, duration, dtype)
      164         else:
      165             raise (exc)
  
  ~/anaconda3/lib/python3.6/site-packages/librosa/core/audio.py in __audioread_load(path, offset, duration, dtype)
      185 
      186     y = []
  --&gt; 187     with audioread.audio_open(path) as input_file:
      188         sr_native = input_file.samplerate
      189         n_channels = input_file.channels
  
  ~/anaconda3/lib/python3.6/site-packages/audioread/__init__.py in audio_open(path, backends)
      114 
      115     # All backends failed!
  --&gt; 116     raise NoBackendError()
  
  NoBackendError: 
  </code></pre>
  <p>I tried to install  <code>ffmpeg</code> and <code>gstreamer</code> as suggested by some previous answers and <a href="https://github.com/librosa/tutorial" rel="nofollow noreferrer">github page of Librosa</a>. But it didn't solve the problem.</p>
  <p>On the contrary, this audio format works well when I run the same code in Google Colab.</p>
  <p>What can be the reason of this error? How to solve it?</p>