JarodMica / audiosplitter_whisper

MIT License
91 stars 35 forks source link

[Errno 2] No such file or directory: 'D:/AI/voice-changer/audiosplitter_whisper/data\\output\\Gawr Gura Vocals.srt' #3

Open ghost opened 1 year ago

ghost commented 1 year ago

File "D:\AI\voice-changer\audiosplitter_whisper\split_audio.py", line 83, in extract_audio_with_srt subs = pysrt.open(srt_file) File "D:\AI\voice-changer\audiosplitter_whisper\split_audio.py", line 167, in process_audio_files extract_audio_with_srt(audio_file_path, srt_file, speaker_segments_dir) File "D:\AI\voice-changer\audiosplitter_whisper\split_audio.py", line 173, in process_audio_files(input_folder) FileNotFoundError: [Errno 2] No such file or directory: 'D:/AI/voice-changer/audiosplitter_whisper/data\output\Gawr Gura Vocals.srt'

JarodMica commented 1 year ago

This means that whisperX is not generating an srt file for your audio or either the audio file is not found so it's not doing transcription. Can you try running vscode as admin to see if this helps?

Smotto commented 1 year ago

Most likely due to the file having spaces, or the path needing to be adjusted based on the operating system.

original: D:/AI/voice-changer/audiosplitter_whisper/data\output\Gawr Gura Vocals.srt

better: D:/AI/voice-changer/audiosplitter_whisper/data/output/Gawr-Gura-Vocals.srt

even better: D:\\AI\\voice-changer\\audiosplitter_whisper\\data\\output\\Gawr-Gura-Vocals.srt

djexskelember commented 1 year ago

same error here, ran vscode in administrator and tried have removed all spacing in the file path but still get the same error: FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/djexs/Desktop/AI-TESTING/audio-output\output\vocals.srt'

the thing that caught my eye was the \ idk if this is intentional or the program decided ah let's switch over with the generated directories.

edit: i've now also tried both diarized on both true and false and both return this error

edit2: found out that : Fatal error in launcher: Unable to create process using '"C:\Users\djexs\Desktop\AI TESTING\audiosplitter_whisper-master\venv\Scripts\python.exe" where the old path is used. i'll see if changing it back might help

edit3: after changing the directory back to /AI TESTING/ it seems to work, idk if anything else i did had impact. sorry in advance if this doesn't work

theokes commented 1 year ago

Simple solution for anyone else. Delete venv folder, redo installation. I forgot what I had changed the folder name from and didn't bother searching through files for something to edit.

JarodMica commented 1 year ago

Not able to reproduce on my end, if you guys have a way to reproduce this issue reliably, it would help greatly in debugging

HumanKR commented 1 year ago

If anyone is having the same problem, here's how to fix it.

  1. getting a FileNotFoundError but not finding the wav file, not the srt. This happens because whisperX doesn't support torch under v2.0.0. I've been using torch v1.13.1 and CUDA 11.6 to use other repos. Luckily, I realized that Windows allows you to use multiple CUDAs by changing environment variables, so I fixed this by doing a clean install of torch v2.0.0 and CUDA 11.8.

  2. like the original topic, not finding the srt file. I had this problem as soon as I solved problem 1. I tried debug in vscode, and I don't know much about ffmpeg, but it seems that ffmpeg is very sensitive to filenames, so I changed all the vocal filenames to numbers (0.wav, 1.wav, 2.wav ...) and this solved the problem. I think the problem is that he used a space instead of an underscore ( _ ) in the filename.

dcheung07 commented 1 year ago

I ran into the same issue as OP with mixed forward and backslashes, and the way that I fixed as follows:

1) In split_audio.py, look for the line that defines the object "input_folder". Should be line 190 if using the cloned repository as of the time of this comment. 2) Append the definition with .replace("/","\\") such that the updated statement looks like: input_folder = filedialog.askdirectory(title="Select input folder").replace("/","\\") 3) I also encountered some separate permissions issues; make sure that you are running VS Code as an admin so that your terminal has elevated privileges, or run the python script from an elevated command prompt or power shell outside of VS Code.

hiffer commented 1 year ago

I ran into the same issue as OP with mixed forward and backslashes, and the way that I fixed as follows:

  1. In split_audio.py, look for the line that defines the object "input_folder". Should be line 190 if using the cloned repository as of the time of this comment.
  2. Append the definition with .replace("/","\") such that the updated statement looks like: input_folder = filedialog.askdirectory(title="Select input folder").replace("/","\\")
  3. I also encountered some separate permissions issues; make sure that you are running VS Code as an admin so that your terminal has elevated privileges, or run the python script from an elevated command prompt or power shell outside of VS Code.

Can confirm adding .replace("/", "\") at line 190 fixes the issue. In my experience this is a whisperx issue, I've been using whisperx on other occasions aside from Jarod's script facing the exact same issue.

JarodMica commented 1 year ago

I ran into the same issue as OP with mixed forward and backslashes, and the way that I fixed as follows:

  1. In split_audio.py, look for the line that defines the object "input_folder". Should be line 190 if using the cloned repository as of the time of this comment.
  2. Append the definition with .replace("/","") such that the updated statement looks like: input_folder = filedialog.askdirectory(title="Select input folder").replace("/","\\")
  3. I also encountered some separate permissions issues; make sure that you are running VS Code as an admin so that your terminal has elevated privileges, or run the python script from an elevated command prompt or power shell outside of VS Code.

Can confirm adding .replace("/", "\") at line 190 fixes the issue. In my experience this is a whisperx issue, I've been using whisperx on other occasions aside from Jarod's script facing the exact same issue.

Sorry, been away from this for a bit. From the error, it looks like it would be an edit for "/" with a single "\" @dcheung07 rather than a "\" right? There were some conflicting phrases there, but I'll go ahead and update it with the "\".

Actually, I realized the markdown of seems to be getting rid of the backslashes, so I'm gonna assume it is actually "\\" from the title of the issue

hiffer commented 1 year ago

I ran into the same issue as OP with mixed forward and backslashes, and the way that I fixed as follows:

  1. In split_audio.py, look for the line that defines the object "input_folder". Should be line 190 if using the cloned repository as of the time of this comment.
  2. Append the definition with .replace("/","") such that the updated statement looks like: input_folder = filedialog.askdirectory(title="Select input folder").replace("/","\\")
  3. I also encountered some separate permissions issues; make sure that you are running VS Code as an admin so that your terminal has elevated privileges, or run the python script from an elevated command prompt or power shell outside of VS Code.

Can confirm adding .replace("/", "") at line 190 fixes the issue. In my experience this is a whisperx issue, I've been using whisperx on other occasions aside from Jarod's script facing the exact same issue.

Sorry, been away from this for a bit. From the error, it looks like it would be an edit for "/" with a single "" @dcheung07 rather than a "\" right? There were some conflicting phrases there, but I'll go ahead and update it with the "".

Actually, I realized the markdown of seems to be getting rid of the backslashes, so I'm gonna assume it is actually "\\" from the title of the issue

That's my bad, I didn't proof read. I tried reaching out on discord to give you some context before pushing an update :P But this is how the error shows up (at least for me) after removing the fix;

FileNotFoundError: [Errno 2] No such file or directory: 'C:/temp/test_jarod/in\\output\\data_extract.srt'

Adding a replace sorts this issue out (and by the title of this issue it seems to be the same issue they are facing)

dcheung07 commented 1 year ago

Actually, I realized the markdown of seems to be getting rid of the backslashes, so I'm gonna assume it is actually "\\" from the title of the issue

Yup this is correct, stupid markdown getting rid of double slashes, but using the specific code I quoted fixes the issue.

P.S. Thank you for your videos and for this script!

AE-GM commented 1 year ago

for me it was because one of the audio had no voice, therefore nothing to transcribe so it couldn't generate the srt. They need to make it so that muted audios are skipped and deleted

TaciteOFF commented 1 year ago

I had exactly the same issue (missing SRT). I downgraded from Torch nightly to Torch Stable and it solved it.

hedizekri commented 11 months ago

Caution ! The correction with .replace("/","\\") makes MacOS usage of this project encountering an error. On macOS and Linux, the folder paths usually use the forward slash (/) rather than backslashes (), which are typically used on Windows systems.

The path string management should change depending on the OS used to run the script.