我正在尝试识别使用FFMPEG从MP3转换的.WAV文件,但是:
代码:
import speech_recognition as sr
r = sr.Recognizer()
voice = sr.AudioFile('voice.wav')
with voice as source:
audio = r.record(source)
r.recognize_google(audio)
跟踪:
Traceback (most recent call last):
File "[...].py", line 30, in <module>
r.recognize_google(audio)
File "[...]\Python37\lib\site-packages\speech_recognition\__init__.py", line 845, in recognize_google
response_text = response.read().decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
当我在第845行的解码命令中添加选项“ errors = ignore”时,返回了JSON错误...,所以我不这么认为。有人遇到这个问题吗?