Seeing "Video no longer exists" when tyring to transcribe a mp3 file from google drive

#9
by pragyaa - opened

Hi,

we are trying to test transcription for few mp3 files but keep getting below error . Any suggestions how to resolve these....the file is available at google drive and we can play the audio file via browser

GoogleDrive] 1z58cGwwo0UNiLQemWnRowy: Downloading webpage
ERROR: [GoogleDrive] 1z58cGwwo0UNiLQemWnRowy: Video no longer exists.
Traceback (most recent call last):
File "/home/ec2-user/.local/lib/python3.9/site-packages/gradio/routes.py", line 289, in run_predict
output = await app.blocks.process_api(
File "/home/ec2-user/.local/lib/python3.9/site-packages/gradio/blocks.py", line 982, in process_api
result = await self.call_function(fn_index, inputs, iterator)
File "/home/ec2-user/.local/lib/python3.9/site-packages/gradio/blocks.py", line 824, in call_function
prediction = await anyio.to_thread.run_sync(
File "/home/ec2-user/.local/lib/python3.9/site-packages/anyio/to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/home/ec2-user/.local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "/home/ec2-user/.local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 867, in run
result = context.run(func, *args)
File "/home/ec2-user/whisper-webui/app.py", line 58, in transcribe_webui
source, sourceName = self.__get_source(urlData, uploadFile, microphoneData)
File "/home/ec2-user/whisper-webui/app.py", line 174, in __get_source
source = download_url(urlData, self.inputAudioMaxDuration)[0]
TypeError: 'NoneType' object is not subscriptable

Looks like an issue with YT-DLP (which is what Whisper-WebUI is using internally) - Google Drive URLs does not seem to work:

(base) PS D:\Temp\Drive> yt-dlp "https://drive.google.com/file/d/13L3R7Li6S479vD7dG3YTsJxFcPwaqw70/view?usp=share_link"
[GoogleDrive] 13L3R7Li6S479vD7dG3YTsJxFcPwaqw70: Downloading webpage
ERROR: [GoogleDrive] 13L3R7Li6S479vD7dG3YTsJxFcPwaqw70: Video no longer exists.

However, I was able to use Google Drive by mounting it as a drive into a Google Colab instance:

# Mount Drive
from google.colab import drive
drive.mount('/content/drive')
# Execute Whisper in the folder with the audio file
!cd /content/drive/MyDrive/AI/Test && python /content/whisper-webui/cli.py --language Japanese out.mka

On AWS you might be able to do the same using RClone.

But perhaps the easiest solution is just to download these MP3 files using your browser, then upload them to the WebUI using the "Upload Audio" form element.

Hi, thanks for your reply. if we use a mp4 file instead of mp3 then that works for Google drive urls also. We have tried using Upload Audio option for mp3 files but that always fails with an error. Our preferred option is to test with Upload audio , below is the error we get we try to use upload audio....any suggestions how to resolve this error

Traceback (most recent call last):
File "/home/ec2-user/.local/lib/python3.9/site-packages/gradio/routes.py", line 289, in run_predict
output = await app.blocks.process_api(
File "/home/ec2-user/.local/lib/python3.9/site-packages/gradio/blocks.py", line 980, in process_api
inputs = self.preprocess_data(fn_index, inputs, state)
File "/home/ec2-user/.local/lib/python3.9/site-packages/gradio/blocks.py", line 891, in preprocess_data
processed_input.append(block.preprocess(inputs[i]))
File "/home/ec2-user/.local/lib/python3.9/site-packages/gradio/components.py", line 1880, in preprocess
sample_rate, data = processing_utils.audio_from_file(
File "/home/ec2-user/.local/lib/python3.9/site-packages/gradio/processing_utils.py", line 193, in audio_from_file
audio = AudioSegment.from_file(filename)
File "/home/ec2-user/.local/lib/python3.9/site-packages/pydub/audio_segment.py", line 728, in from_file
info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
File "/home/ec2-user/.local/lib/python3.9/site-packages/pydub/utils.py", line 279, in mediainfo_json
info = json.loads(output)
File "/usr/local/lib/python3.9/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3
.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Hi , any suggestions on how to solve issue seen with upload audio file / mp3 as listed above

Could this an issue with FFmpeg or FFprobe? I see that Gradio is using PyDub to extract some metadata from the uploaded file (in processing_utils.py), which in turns depends on FFprobe to extract information such as codec/bitrate/sample rate, etc.

The core method that is extracting the metadata is PyDub/utils.py, in medainfo_json. It creates a command that instructs FFProbe to extract metadata from the file and return it as JSON:

ffprobe -of json -v info -show_format -show_streams FILE_PATH

This method uses json.loads to turn the parse the resulting JSON into Python readable dictionaries, but here is where it fails.

I tried to reproduce this problem on my computer, but even when I intentially supplied an invalid MP3 file (by renaming a textfile to .mp3),
mediainfo_json still worked:

from pydub.utils import mediainfo_json 
file = "D:\\Temp\\Test.mp3"
print(mediainfo_json(file))
# Prints {}

Here, mediainfo_json doesn't complain about an invalid MP3 file, but it does receive an error from FFProbe (in stderr = stderr.decode), which reads Failed to read frame size: Could not seek to 1027.\r\nD:\\Temp\\Test.mp3: Invalid argument\r\n'. Still, you should not be getting the json.decoder.JSONDecodeError error even with an invalid MP3 file.

So, what I think might be happening is that you might be using an ancient version of FFprobe/FFmpeg that doesn't support JSON output. You can test if it does by using the "ffprobe" command against your MP3 file:

ffprobe -of json -v quiet -show_format -show_streams YOUR-FILE.mp3

If this doesn't output JSON, you must upgrade FFprobe. I haven't upgraded/installed FFmpeg on AWS myself, but I imagine you can just download the static builds from FFmpeg.org and add them to your $PATH variable.

pragyaa changed discussion status to closed

Sign up or log in to comment