Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot open Ogg FLAC file: unknown error in flac decoder #424

Open
nukemiko opened this issue Dec 19, 2023 · 1 comment
Open

Cannot open Ogg FLAC file: unknown error in flac decoder #424

nukemiko opened this issue Dec 19, 2023 · 1 comment

Comments

@nukemiko
Copy link

Try to open an Ogg FLAC file with soundfile:

In [1]: import soundfile

In [2]: soundfile.__version__
Out[2]: '0.12.1'

In [3]: soundfile.__libsndfile_version__
Out[3]: '1.2.2'

In [4]: sf = soundfile.SoundFile('oggflac.ogg')
---------------------------------------------------------------------------
LibsndfileError                           Traceback (most recent call last)
Cell In[4], line 1
----> 1 sf = soundfile.SoundFile('oggflac.ogg')

File /usr/lib/python3.11/site-packages/soundfile.py:658, in SoundFile.__init__(self, file, mode, samplerate, channels, subtype, endian, format, closefd)
    655 self._mode = mode
    656 self._info = _create_info_struct(file, mode, samplerate, channels,
    657                                  format, subtype, endian)
--> 658 self._file = self._open(file, mode_int, closefd)
    659 if set(mode).issuperset('r+') and self.seekable():
    660     # Move write position to 0 (like in Python file objects)
    661     self.seek(0)

File /usr/lib/python3.11/site-packages/soundfile.py:1216, in SoundFile._open(self, file, mode_int, closefd)
   1213 if file_ptr == _ffi.NULL:
   1214     # get the actual error code
   1215     err = _snd.sf_error(file_ptr)
-> 1216     raise LibsndfileError(err, prefix="Error opening {0!r}: ".format(self.name))
   1217 if mode_int == _snd.SFM_WRITE:
   1218     # Due to a bug in libsndfile version <= 1.0.25, frames != 0
   1219     # when opening a named pipe in SFM_WRITE mode.
   1220     # See http://github.com/erikd/libsndfile/issues/77.
   1221     self._info.frames = 0

LibsndfileError: Error opening 'oggflac.ogg': Error : unknown error in flac decoder.

In [5]:
$ > file oggflac.ogg 
oggflac.ogg: Ogg data, FLAC audio
@bastibe
Copy link
Owner

bastibe commented Dec 20, 2023

This error originates in libsndfile, and will need to be dealt with on their end. It may be a malformed FLAC file (check with a known-good one), or a bug in libflac, as called by libsndfile. It may also have been fixed already, as our libsndfile is outdated by about half a year. Work is ongoing on a new version, hopefully to be released in the next few weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants