polymath icon indicating copy to clipboard operation
polymath copied to clipboard

Mp3 files give a "File contains data in an unknown format" error

Open TheJMK opened this issue 2 years ago • 1 comments

I couldn't get it to work. Here's the full error stack. The file is an mp3 file with MPEG Audio Layer 1/2 codec (mpga), at 48khz

Found 232 wav or mp3 files ------ process audio C:/Users/Music/Mantovani\Adios Muchachos.mp3 converting mp3 to wav: C:/Users/Music/Mantovani\Adios Muchachos.mp3 C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\librosa\util\decorators.py:88: UserWarning: PySoundFile failed. Trying audioread instead. return f(*args, **kwargs) Traceback (most recent call last): File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\librosa\core\audio.py", line 164, in load y, sr_native = __soundfile_load(path, offset, duration, dtype) File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\librosa\core\audio.py", line 195, in __soundfile_load context = sf.SoundFile(path) File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\soundfile.py", line 740, in init self._file = self._open(file, mode_int, closefd) File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\soundfile.py", line 1264, in _open _error_check(_snd.sf_error(file_ptr), File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\soundfile.py", line 1455, in _error_check raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace')) RuntimeError: Error opening 'C:/Users/Music/Mantovani\Adios Muchachos.mp3': File contains data in an unknown format.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\Music\Samples\Polymath\polymath\polymath.py", line 690, in main() File "C:\Users\Music\Samples\Polymath\polymath\polymath.py", line 571, in main videos = audio_directory_process(vids,videos) File "C:\Users\Music\Samples\Polymath\polymath\polymath.py", line 122, in audio_directory_process videos = audio_process(filesToProcess, videos) File "C:\Users\Music\Samples\Polymath\polymath\polymath.py", line 149, in audio_process y, sr = librosa.load(path=vid, sr=None, mono=False) File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\librosa\util\decorators.py", line 88, in inner_f return f(*args, **kwargs) File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\librosa\core\audio.py", line 170, in load y, sr_native = __audioread_load(path, offset, duration, dtype) File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\librosa\core\audio.py", line 226, in _audioread_load reader = audioread.audio_open(path) File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\audioread_init.py", line 132, in audio_open raise NoBackendError() audioread.exceptions.NoBackendError

TheJMK avatar Feb 17 '23 11:02 TheJMK

Next time, please try to include as many details about your setup as possible like OS version, pyenv/conda environment, python version, etc. as it greatly helps to trace down issues and improve the software and its documentation.

From the error, it seems that you are missing ffmpeg. You can find instructions for how to install ffmpeg on your version of Widows. If you are using conda, you can try calling conda install ffmpeg. Hope this helps.

faradox avatar Feb 17 '23 12:02 faradox