nestyme / Subtitles-generator

generates transcript for video from link
87 stars 29 forks source link

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

Open ropinheiro opened 4 years ago

ropinheiro commented 4 years ago

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.

Mladia commented 4 years ago

librosa does not support output anymore from librosa changelogs:

917 The output module is now deprecated, and will be removed in version 0.8.

Sadam1195 commented 3 years ago

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

Sangramsingkayte commented 3 years ago

(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'

Sadam1195 commented 3 years ago

(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.pywith the comments in https://github.com/nestyme/Subtitles-generator/issues/4#issuecomment-811855424 @Sangramsingkayte

carlosmatthews commented 3 years ago

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

Sadam1195 commented 3 years ago

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

carlosmatthews commented 3 years ago

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