【问题标题】:Transcribe an Audio File in Python用 Python 转录音频文件
【发布时间】:2021-04-05 22:46:26
【问题描述】:

我正在尝试转录一个有点大的音频文件。它的属性如下。

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()

【问题讨论】:

  • 去掉duration=60还是把真正的总长度放在那里?或者并行处理多个部分,如果这就是您的意思?
  • @B.去尝试第一个。它不起作用。将尝试并行处理。谢谢!
  • @B.由于文件太大,Go 它不起作用。

标签: python speech-recognition speech-to-text


【解决方案1】:

speech_recognition python 包只是一个包装器,它甚至不提供基本功能。

如果你想使用 Google Speech API(付费),你可以这样做:

https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/speech/cloud-client/transcribe_async.py

如果你想考虑Bing,它也提供了类似的API,见How can I transcribe a speech file with the Bing Speech API in Python?

对于免费替代方案,请考虑https://github.com/alumae/kaldi-offline-transcriber

【讨论】:

  • @Nikolay Shmyrev 非常感谢!
  • 试用了 Google Speech free 和 GCP 版本,结果都不好 - 财务方面。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-03-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-30
相关资源
最近更新 更多