Subtitles-generator
Subtitles-generator copied to clipboard
AttributeError: module 'librosa' has no attribute 'output'
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.
librosa does not support output anymore from librosa changelogs: #917 The output module is now deprecated, and will be removed in version 0.8.
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
(Speech) Sangram:resample sing$ python resample.py
Traceback (most recent call last):
File "resample.py", line 8, in
(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
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
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
thanks, @Sadam1195 , Thank you very much I did not find the problem