#1356 openai.BadRequestError: Error code: 400 - {'error': {'message': 'Audio file might be corrupted or unsupported', 'type':

14.169* Posted at: 29 days ago 👁75

Error during speech recognition:[OpenAI Speech to Text] Request parameters incorrect, check input or settings Error code: 400 - {'error': {'message': 'Audio file might be corrupted or unsupported', 'type': 'invalid_request_error', 'param': 'file', 'code': 'invalid_value'}}:
Traceback (most recent call last):
File "videotrans\task\job.py", line 105, in run
File "videotrans\task\_speech2text.py", line 133, in recogn
File "videotrans\recognition\__init__.py", line 215, in run
File "videotrans\recognition\_base.py", line 78, in run
File "videotrans\recognition\_openairecognapi.py", line 44, in _exec
File "videotrans\recognition\_openairecognapi.py", line 99, in _thrid_api
File "openai\_utils\_utils.py", line 286, in wrapper
File "openai\resources\audio\transcriptions.py", line 406, in create
File "openai\_base_client.py", line 1259, in post
File "openai\_base_client.py", line 1047, in request
openai.BadRequestError: Error code: 400 - {'error': {'message': 'Audio file might be corrupted or unsupported', 'type': 'invalid_request_error', 'param': 'file', 'code': 'invalid_value'}}


=
system:Windows-10-10.0.22621-SP0
version:v3.83
frozen:True
language:en
root_dir:H:/KuroSoftware/win-videotrans

1 Replies

The error indicates that OpenAI's Speech-to-Text API is rejecting your audio file, stating it might be "corrupted or unsupported". This is a common issue with the OpenAI API recognition channel. Here are the primary solutions:

  1. Check Audio Format: The OpenAI API has strict requirements. Ensure your source video/audio file is in a standard, widely supported format like MP3, WAV, MP4, or M4A. If your file is in a different format (e.g., AVI, MKV, FLAC), convert it to MP4 or MP3 first using another tool.
  2. Use a Local Recognition Model (Recommended): The most reliable and free solution is to switch to a local speech recognition model.

    • Go to the "Speech Recognition Channel" dropdown on the main translation interface.
    • Select "faster-whisper(local)".
    • Choose a model like "large-v3" for high accuracy.
    • Ensure "CUDA Acceleration" is checked if you have an NVIDIA GPU for faster processing.
  3. Verify API Key and Settings:

    • Go to Menu -> Speech Recognition Settings -> OpenAI Whisper API.
    • Confirm your API Key is correct and has sufficient credits.
    • Ensure the "Source Language" selected in the main interface matches the language spoken in your audio file. If unsure, try setting it to "Auto Detect".
  4. Extract and Test the Audio: The error can sometimes be caused by a complex video container. Try extracting the audio track from your video file as a standalone MP3 file using a tool like FFmpeg or VLC, and then use that MP3 file as the input for pyVideoTrans.

The "faster-whisper" local model is generally more robust for handling various audio files and is the recommended approach to avoid this specific API error.

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Donate: https://ko-fi.com/jianchang512

Similar issues already exist

Trending Questions