zh-plus / openlrc

Transcribe and translate voice into LRC file using Whisper and LLMs (GPT, Claude, et,al). 使用whisper和LLM(GPT,Claude等)来转录、翻译你的音频为字幕文件。
https://zh-plus.github.io/openlrc/
MIT License
429 stars 28 forks source link

FileNotFoundError: [WinError 2] The system cannot find the file specified: 'data\\preprocessed\\track5_ln.wav' -> 'data\\preprocessed\\track5_preprocessed.wav' #23

Closed VertofChest closed 6 months ago

VertofChest commented 8 months ago

I get this error when running the code. Help?

`C:\Test\whisperx>whisper-this-lc.py
C:\Users\Vert\AppData\Local\Programs\Python\Python311\Lib\site-packages\df\io.py:9: UserWarning: `torchaudio.backend.common.AudioMetaData` has been moved to `torchaudio.AudioMetaData`. Please update the import path.
  from torchaudio.backend.common import AudioMetaData
 [2023-12-27 14:20:22] INFO     [MainThread] Default context config not found: Context(background=, audio_type=Anime, description_map={}), using default context.
 [2023-12-27 14:20:22] INFO     [MainThread] Preprocessed audio already exists in data\preprocessed\track1_preprocessed.wav
 [2023-12-27 14:20:22] INFO     [MainThread] Preprocessed audio already exists in data\preprocessed\track2_preprocessed.wav
 [2023-12-27 14:20:22] INFO     [MainThread] Preprocessed audio already exists in data\preprocessed\track3_preprocessed.wav
 [2023-12-27 14:20:22] INFO     [MainThread] Preprocessed audio already exists in data\preprocessed\track4_preprocessed.wav
 [2023-12-27 14:20:22] INFO     [MainThread] Loudness normalizing...
C:\Users\Vert\AppData\Local\Programs\Python\Python311\Lib\site-packages\df\io.py:9: UserWarning: `torchaudio.backend.common.AudioMetaData` has been moved to `torchaudio.AudioMetaData`. Please update the import path.
  from torchaudio.backend.common import AudioMetaData
 [2023-12-27 14:20:29] INFO     [MainThread] Normalizing file track5.wav (1 of 1)
 [2023-12-27 14:20:29] INFO     [MainThread] Running first pass loudnorm filter for stream 0
 [2023-12-27 14:20:39] INFO     [MainThread] Running second pass for data\track5.wav
 [2023-12-27 14:20:39] ERROR    [MainThread] Error while running command 'C:\Program Files\ImageMagick-7.0.10-Q16-HDRI\ffmpeg.EXE' -hide_banner -y -i 'data\track5.wav' -filter_complex '[0:0]loudnorm=i=-23.0:lra=21.3:tp=-2.0:offset=-0.18:measured_i=-13.62:measured_lra=21.3:measured_tp=-2.6:measured_thresh=-28.24:linear=true:print_format=json[norm0]' -map_metadata 0 -map_metadata:s:a:0 0:s:a:0 -map_chapters 0 -map '[norm0]' -c:a pcm_s16le -ar 48000 -c:s copy -f wav 'C:\Users\Vert\AppData\Local\Temp\tmpmwnezkx8\out.wav'! Error: Error running command ['C:\\Program Files\\ImageMagick-7.0.10-Q16-HDRI\\ffmpeg.EXE', '-hide_banner', '-y', '-i', 'data\\track5.wav', '-filter_complex', '[0:0]loudnorm=i=-23.0:lra=21.3:tp=-2.0:offset=-0.18:measured_i=-13.62:measured_lra=21.3:measured_tp=-2.6:measured_thresh=-28.24:linear=true:print_format=json[norm0]', '-map_metadata', '0', '-map_metadata:s:a:0', '0:s:a:0', '-map_chapters', '0', '-map', '[norm0]', '-c:a', 'pcm_s16le', '-ar', '48000', '-c:s', 'copy', '-f', 'wav', 'C:\\Users\\Vert\\AppData\\Local\\Temp\\tmpmwnezkx8\\out.wav']: Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from 'data\track5.wav':
Duration: 00:04:45.33, bitrate: 2822 kb/s
Stream #0:0: Audio: pcm_s32le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s32, 2822 kb/s
[loudnorm @ 00000287a4d25580] Value 21.300000 for parameter 'lra' out of range [1 - 20]
Last message repeated 1 times
[loudnorm @ 00000287a4d25580] Error setting option lra to value 21.3.
[Parsed_loudnorm_0 @ 00000287a4d73a40] Error applying options to the filter.
[AVFilterGraph @ 00000287a4d74400] Error initializing filter 'loudnorm' with args 'i=-23.0:lra=21.3:tp=-2.0:offset=-0.18:measured_i=-13.62:measured_lra=21.3:measured_tp=-2.6:measured_thresh=-28.24:linear=true:print_format=json'
Error initializing complex filters.
Result too large

Traceback (most recent call last):
  File "C:\StableDiff\whisperx\whisper-this-lc.py", line 5, in <module>
    lrcer.run(['./data/track1.wav', './data/track2.wav', './data/track3.wav', './data/track4.wav', './data/track5.wav'], target_lang='en-us')
  File "C:\Users\Vert\AppData\Local\Programs\Python\Python311\Lib\site-packages\openlrc\openlrc.py", line 224, in run
    audio_paths = self.pre_process(paths, noise_suppress=noise_suppress)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Vert\AppData\Local\Programs\Python\Python311\Lib\site-packages\openlrc\openlrc.py", line 282, in pre_process
    paths = preprocessor.run(noise_suppress)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Vert\AppData\Local\Programs\Python\Python311\Lib\site-packages\openlrc\preprocess.py", line 136, in run
    ln_path = ln_path.rename(ln_path.parent / f'{audio_name}_preprocessed.wav')
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Vert\AppData\Local\Programs\Python\Python311\Lib\pathlib.py", line 1175, in rename
    os.rename(self, target)
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'data\\preprocessed\\track5_ln.wav' -> 'data\\preprocessed\\track5_preprocessed.wav'`
zh-plus commented 8 months ago

It seems the ffmpeg reports an error:

[Parsed_loudnorm_0 @ 00000287a4d73a40] Error applying options to the filter.
[AVFilterGraph @ 00000287a4d74400] Error initializing filter 'loudnorm' with args 'i=-23.0:lra=21.3:tp=-2.0:offset=-0.18:measured_i=-13.62:measured_lra=21.3:measured_tp=-2.6:measured_thresh=-28.24:linear=true:print_format=json'
Error initializing complex filters.

Could you please share the track5.wav file with me and let me know the version of ffmpeg using the command ffmpeg -version? So I can attempt to replicate this error.

VertofChest commented 8 months ago

It seems the ffmpeg reports an error:

[Parsed_loudnorm_0 @ 00000287a4d73a40] Error applying options to the filter.
[AVFilterGraph @ 00000287a4d74400] Error initializing filter 'loudnorm' with args 'i=-23.0:lra=21.3:tp=-2.0:offset=-0.18:measured_i=-13.62:measured_lra=21.3:measured_tp=-2.6:measured_thresh=-28.24:linear=true:print_format=json'
Error initializing complex filters.

Could you please share the track5.wav file with me and let me know the version of ffmpeg using the command ffmpeg -version? So I can attempt to replicate this error.

Of course! Here is track 5 in .mp3 format (both .wav and .mp3 report the same error, I simply changed type to reduce upload size here on Github) track5.zip

Here is my ffmpeg version:


built with gcc 9.3.1 (GCC) 20200523
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil      56. 31.100 / 56. 31.100
libavcodec     58. 54.100 / 58. 54.100
libavformat    58. 29.100 / 58. 29.100
libavdevice    58.  8.100 / 58.  8.100
libavfilter     7. 57.100 /  7. 57.100
libswscale      5.  5.100 /  5.  5.100
libswresample   3.  5.100 /  3.  5.100
libpostproc    55.  5.100 / 55.  5.100```

Additional Info: It appears this error occurs when processing too many files at the same time, however there is something very finicky about track5 in particular that causes a problem

Thanks for the response! ☺
zh-plus commented 8 months ago

It could be due to the version of ffmpeg. Try installing the latest version of ffmpeg from https://www.youtube.com/watch?v=5xgegeBL0kw&ab_channel=CodingSensei.

Here is the output of my ffmpeg -version:

> ffmpeg -version
ffmpeg version 6.1-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-dxva2 --enable-d3d11va --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil      58. 29.100 / 58. 29.100
libavcodec     60. 31.102 / 60. 31.102
libavformat    60. 16.100 / 60. 16.100
libavdevice    60.  3.100 / 60.  3.100
libavfilter     9. 12.100 /  9. 12.100
libswscale      7.  5.100 /  7.  5.100
libswresample   4. 12.100 /  4. 12.100
libpostproc    57.  3.100 / 57.  3.100
yunlingling123 commented 8 months ago

Did you use lrcer.run() in the if __name__ == '__main__':?;I solved this due to the multiprocessing in windows, and another way may be is to upgrade theffmpeg-normalize

deng-cy commented 8 months ago

I got similar error and solved by using the latest ffmeg. You can download the complied one from the website and copy the file ffmeg to /usr/local/bin. The latest version is 6.x, but somehow if you install by apt, it only gives 4.x