在 Python 中转录音频文件
Transcribe an Audio File in Python
我正在尝试转录一个有点大的音频文件。它的属性如下。
Size : 278.3 MB
Duration : 52 minutes
Format : WAV
Follwoing 是我用来转换它的代码,持续时间为 60 秒。能否请您建议立即转录此文件?
import speech_recognition as sr
r = sr.Recognizer()
with sr.AudioFile('sampleMp3.WAV') as source:
audio = r.record(source, duration=60)
command = r.recognize_google(audio)
text_file = open("Output.txt", "w")
text_file.write(command)
text_file.close()
speech_recognition python 包只是一个包装器,它甚至不提供基本功能。
如果你想使用Google语音API(付费),你可以这样做:
如果要考虑Bing,也提供类似API,见How can I transcribe a speech file with the Bing Speech API in Python?
对于免费替代方案,请考虑 https://github.com/alumae/kaldi-offline-transcriber
我正在尝试转录一个有点大的音频文件。它的属性如下。
Size : 278.3 MB
Duration : 52 minutes
Format : WAV
Follwoing 是我用来转换它的代码,持续时间为 60 秒。能否请您建议立即转录此文件?
import speech_recognition as sr
r = sr.Recognizer()
with sr.AudioFile('sampleMp3.WAV') as source:
audio = r.record(source, duration=60)
command = r.recognize_google(audio)
text_file = open("Output.txt", "w")
text_file.write(command)
text_file.close()
speech_recognition python 包只是一个包装器,它甚至不提供基本功能。
如果你想使用Google语音API(付费),你可以这样做:
如果要考虑Bing,也提供类似API,见How can I transcribe a speech file with the Bing Speech API in Python?
对于免费替代方案,请考虑 https://github.com/alumae/kaldi-offline-transcriber