我需要使用音频段库将音频转换为文本我安装了它,但是当我运行项目并且它不起作用时,它在运行时显示警告:
RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
sound = AudioSegment.from_ogg('user.ogg')
sound.export('user.wav', format="wav")
r = sr.Recognizer()
with sr.AudioFile("user.wav") as source:
audio = r.record(source)
text = r.recognize_google(audio)
print(text)
Note: It was working before I format my computer ,But when I try to reinstall it ,The Message Appears.
我需要你的帮助
和谢谢你...
最佳答案
打开ffmpeg页面时,不要选择下载代码的选项。而是选择安装 .exe 文件。完成后,您将在 ffmpeg 文件夹内的 bin 文件夹中看到 ffmpeg.exe。最后,将 bin 文件夹的路径放入 PATH 系统/用户变量中。
关于python - Python Telegram Bot 中的音频段库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68979842/