Subtitles-generator icon indicating copy to clipboard operation
Subtitles-generator copied to clipboard

AttributeError: module 'librosa' has no attribute 'output'

Open ropinheiro opened this issue 4 years ago • 7 comments

When I run this command:

python3 recognize.py -video Flow.mp4

It apparently works until this part, where an error occurs:

(...)
video duration, hours: 0.6886200050390526
Traceback (most recent call last):
  File "recognize.py", line 55, in <module>
    split_into_frames('current.wav')
  File "recognize.py", line 49, in split_into_frames
    librosa.output.write_wav('samples/{}.wav'.format(chr(int(i/50)+65)), tmp_batch, sr)
AttributeError: module 'librosa' has no attribute 'output'

A current.wav is generated, but no subtitles file appears.

ropinheiro avatar Jul 30 '20 20:07 ropinheiro

librosa does not support output anymore from librosa changelogs: #917 The output module is now deprecated, and will be removed in version 0.8.

Mladia avatar Sep 12 '20 13:09 Mladia

you can substitute

librosa.output.write_wav('samples/{}.wav'.format(chr(int(i/50)+65)), tmp_batch, sr)

with

import soundfile as sf
sf.write('samples/{}.wav'.format(chr(int(i/50)+65)), tmp_batch, sr)

in your code.

@ropinheiro

Sadam1195 avatar Apr 01 '21 11:04 Sadam1195

(Speech) Sangram:resample sing$ python resample.py Traceback (most recent call last): File "resample.py", line 8, in librosa.output.write_wav(newFilename, y_16, 16000) AttributeError: module 'librosa' has no attribute 'output'

Sangramsingkayte avatar May 19 '21 12:05 Sangramsingkayte

(Speech) Sangram:resample sing$ python resample.py Traceback (most recent call last): File "resample.py", line 8, in librosa.output.write_wav(newFilename, y_16, 16000) AttributeError: module 'librosa' has no attribute 'output'

Please edit the code in resample.py with the comments in https://github.com/nestyme/Subtitles-generator/issues/4#issuecomment-811855424 @Sangramsingkayte

Sadam1195 avatar May 25 '21 11:05 Sadam1195

Hy , I edit the code in resample.py with the comments in #4 (comment).

sf.write('samples/{}.wav'.format(chr(int(i/50)+65)), tmp_batch, sr)`

but I get an error with the new library (soundfile)

File "C:\Python38\lib\site-packages\soundfile.py", line 1357, in _error_check raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace')) RuntimeError: Error opening 'samples/A.wav': System error.

@Sadam1195

carlosmatthews avatar May 25 '21 16:05 carlosmatthews

Hy , I edit the code in resample.py with the comments in #4 (comment).

sf.write('samples/{}.wav'.format(chr(int(i/50)+65)), tmp_batch, sr)`

but I get an error with the new library (soundfile)

File "C:\Python38\lib\site-packages\soundfile.py", line 1357, in _error_check raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace')) RuntimeError: Error opening 'samples/A.wav': System error.

Error indicates that you do not have samples folder in that directory. Please create samples folder manually and rerun the code.

@carlosmatthews

Sadam1195 avatar May 25 '21 18:05 Sadam1195

thanks, @Sadam1195 , Thank you very much I did not find the problem

carlosmatthews avatar May 25 '21 18:05 carlosmatthews