Retrieval-based-Voice-Conversion-WebUI icon indicating copy to clipboard operation
Retrieval-based-Voice-Conversion-WebUI copied to clipboard

RuntimeError: Failed to load audio: ffmpeg error (see stderr output for detail)

Open Tomissugo opened this issue 1 year ago • 19 comments

No spaces in the audio path, and it's a wav file. Could anybody help me ?

Traceback (most recent call last):
  File "F:\Retrieval-based-Voice-Conversion-WebUI-updated0618v2\infer-web.py", line 178, in vc_single
    audio = load_audio(input_audio_path, 16000)
  File "F:\Retrieval-based-Voice-Conversion-WebUI-updated0618v2\my_utils.py", line 19, in load_audio
    raise RuntimeError(f"Failed to load audio: {e}")
RuntimeError: Failed to load audio: ffmpeg error (see stderr output for detail)

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gradio\routes.py", line 321, in run_predict
    output = await app.blocks.process_api(
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gradio\blocks.py", line 1007, in process_api
    data = self.postprocess_data(fn_index, result["prediction"], state)
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gradio\blocks.py", line 953, in postprocess_data
    prediction_value = block.postprocess(prediction_value)
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gradio\components.py", line 2076, in postprocess
    processing_utils.audio_to_file(sample_rate, data, file.name)
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gradio\processing_utils.py", line 206, in audio_to_file
    data = convert_to_16_bit_wav(data)
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gradio\processing_utils.py", line 219, in convert_to_16_bit_wav
    if data.dtype in [np.float64, np.float32, np.float16]:
AttributeError: 'NoneType' object has no attribute 'dtype'

Tomissugo avatar Jul 01 '23 04:07 Tomissugo

Same issue in Colab.

MojoPriest42 avatar Jul 01 '23 09:07 MojoPriest42

Same issue in Colab

Turkmen48 avatar Jul 01 '23 20:07 Turkmen48

same issue in colab

ethanye77 avatar Jul 04 '23 06:07 ethanye77

same issue building a docker image

ArturoLlC avatar Jul 05 '23 19:07 ArturoLlC

did anyone find the solution. i am stuck

rocky810 avatar Jul 08 '23 07:07 rocky810

same issue

Andyholm avatar Jul 09 '23 01:07 Andyholm

same issue

pythour avatar Jul 14 '23 04:07 pythour

Can y'all test this and see if it works? Worked for me. :) https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/issues/711#issue-1795198576

Andyholm avatar Jul 14 '23 23:07 Andyholm

Does not work for me.

Same issue.

LouSparfell avatar Jul 29 '23 12:07 LouSparfell

Hello, I got the same issue, but this error doesn't stop the training and after this the training continues

Onepierre avatar Aug 14 '23 16:08 Onepierre

@Tomissugo and all the others, If you still have the error try to change the file's except block from

except Exception as e:
        raise RuntimeError(f"Failed to load audio: {e}")`

into

except Exception as e:
        print("stderr:", e.stderr.decode("utf8"))
        raise RuntimeError(f"Failed to load audio: {e}")

It will give you more details about the real error. For my part it was a mistake in the name of the wav file

Onepierre avatar Aug 14 '23 17:08 Onepierre

Hello. I had the same issue, and Onepierre was correct on how the system couldnt find the files. In my case, the the python was trying to read the DESKTOP.INI system file in the folder, but for some reason it was NOT matching the files that were in the folder. I deleted the DESKTOP.INI out of the input folder and everything worked fine then. No false/non existent files to fail on.

Madox01b avatar Sep 02 '23 17:09 Madox01b

same thing on autodl. can't fix this

stickbrime avatar Nov 14 '23 10:11 stickbrime

can't fix this need something else.

mo2562431 avatar Feb 09 '24 05:02 mo2562431

I just got this error, but the reason was the path was wrong, I had the parent folder and not the folder with the actual audio files.

so double check your path, and if that doesn't work try renaming them to have only letters

skeddles avatar Feb 20 '24 20:02 skeddles

My filepath is correct. I am trying use it to transcribe using flask. I have the same error also.

my code is

app.py

from flask import Flask, render_template, redirect, request, url_for from flask_sqlalchemy import SQLAlchemy import whisper from werkzeug.utils import secure_filename import os

app = Flask(name) app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///transcribe.db" db = SQLAlchemy(app) app.app_context().push()

class Transcription(db.Model): sno = db.Column(db.Integer, primary_key = True) text = db.Column(db.Text, nullable=False)

def __repr__(self) -> str:
    return f"{self.sno} - {self.text}"

UPLOAD_FOLDER = r'D:\Flask\TextSummariser\FileAudio' app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER

def allowed_file(filename): return '.' in filename and
filename.rsplit('.', 1)[1].lower() in {'mp3', 'wav'}

@app.route('/', methods=['GET', 'POST']) def file_upload(): if request.method == 'POST': # check if the post request has the file part if 'file' not in request.files: return redirect(request.url) file = request.files['file'] print(file.filename) # if user does not select file, browser also # submit an empty part without filename if file.filename == '': return redirect(request.url) print(allowed_file(file.filename)) if file and allowed_file(file.filename): filename = secure_filename(file.filename) file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) file_path = os.path.join(app.config['UPLOAD_FOLDER'], filename) file.save(file_path) print("File saved to:", file_path)

        model = whisper.load_model("base")
        print("Model loaded")

        transcription_text = model.transcribe(file_path)
        print("Transcription Completed")

        transcription = Transcription(text=transcription_text)
        db.session.add(transcription)
        db.session.commit()
        return redirect(url_for('uploaded_file', filename=filename))
    
return render_template('index.html')

@app.route('/uploads/') def uploaded_file(filename): return f'''

{filename} uploaded successfully

'''

if name == 'main': app.run(debug=True)

index.html

Text Summariser
<style>
  .input-group-text{
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .custom-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    width: 400px;
    text-align: center;
    margin: auto;
    margin-top: 50px;
  }
  .custom-heading {
    margin-top: 0;
    color: gray;
  }
  .custom-input-file {
    margin: 20px 0;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f9f9f9;
    width: 100%;
  }
  .custom-submit-btn {
    padding: 10px 20px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
  }
  .custom-submit-btn:hover {
    background-color: #0056b3;
  }
  .custom-footer {
    background-color: #212529;
    padding: 10px 0;
    position: fixed;
    left: 20px;
    bottom: 20px;
    width: calc(100% - 40px);
    color: white;
    text-align: center;
    display: flex;
    justify-content: center;
  }
</style>
<div class="custom-container">
  <h2 class="custom-heading">Upload an Audio File</h2>
  <form action="/" method="POST" enctype="multipart/form-data">
    <div class="input-group">
      <input type="file" name="file" class="custom-input-file" onchange="displayFileName(this)"
      />
      <label class="input-group-text" for="file">Choose file</label>
    </div>
    <input type="submit" value="Upload" class="custom-submit-btn" />
  </form>
</div>

<div class="custom-footer">
  <p>Text Summariser by Team SSLP</p>
</div>

<script>
  function displayFileName(input) {
    const label = input.nextElementSibling;
    const fileName = input.files[0].name;
    label.innerText = fileName;
  }
</script>

pls help.

The audio file is uploaded in the given flask directory but the transcription doesn't get to work. The model gets loaded but the audio file is not being loaded in the transcribe function

Sayam-Ganguly avatar Mar 04 '24 16:03 Sayam-Ganguly

In my case, using sub directory under RVC as training folder (eg: ./content) solved this problem.

onejae avatar Mar 12 '24 00:03 onejae

In my case, using sub directory under RVC as training folder (eg: ./content) solved this problem

I have the same issue with RVC, what do u mean by creating sub directory ?

barbaram123 avatar Apr 04 '24 10:04 barbaram123

For me it was because the audio file it was trying to read didn't exist.

Lunatunny avatar Apr 06 '24 13:04 Lunatunny

This issue was closed because it has been inactive for 15 days since being marked as stale.

github-actions[bot] avatar May 23 '24 04:05 github-actions[bot]