【问题标题】:PyGST GStreamer corrupted file with google speech apiPyGST GStreamer 使用谷歌语音 api 损坏的文件
【发布时间】:2013-10-28 14:23:15
【问题描述】:

在树莓派上,我尝试使用 gstreamer 将音频录制为 .flac 或 .wav 文件。

我希望将音频文件发送到非官方的谷歌语音 api 服务器

但我的 gstreamer 管道输出为 wav

 gst-launch-0.10 -e  alsasrc device=hw:1 ! audioconvert ! audioresample ! audio/x-raw-int, depth=16, rate=16000, channels=1 ! wavenc ! filesink location= o.wav

或作为flac

 gst-launch-0.10 -e  alsasrc device=hw:1 ! audioconvert ! audioresample ! audio/x-raw-int, depth=16, rate=16000, channels=1 ! flacenc ! filesink location= o.flac

总是被拒绝。

错误:(错误的文件格式或错误的采样率)

{"status":5,"id":"11e0fa5e371b2f0a1a87def81f8383bc-1","hypotheses":[]}

使用 sox 进行正常录制并使用 ffmpeg 或 flac 进行编码正在工作,所以我猜 gstreamer 的输出文件不知何故损坏了,或者我缺少某些东西

编辑: 使用 -v http://hastebin.com/vovefeyewe.vbs 运行的管道在 alsasrc 之后添加了一个队列 但还是一样的问题

已解决

附加参数解决了问题

 gst-launch-0.10 -e -v alsasrc device=hw:1 ! audioconvert ! audioresample ! "audio/x-raw-int, rate=(int)16000, channels=(int)1, endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean)true, channles=(int)1" ! wavenc ! filesink location=g.wav

如果没有声音或只有随机噪音,谷歌将拒绝带有(错误格式错误)的文件

【问题讨论】:

    标签: speech-recognition gstreamer recording voice-recording pygst


    【解决方案1】:

    您可以在管道中添加 -v 选项并发送输出吗?

    【讨论】:

    • 试试这个管道,但我不确定它是否有效。 gst-launch-0.10 -e -v alsasrc device=hw:1 !音频转换!音频重采样! “音频/x-raw-int,速率=(int)16000,通道=(int)1,字节序=(int)1234,宽度=(int)16,深度=(int)16,有符号=(布尔)真,频道=(int)1“!波浪!文件接收器位置=g.wav
    • 真的很奇怪。我不知道为什么管道不起作用。看来是硬件问题。 opencast.3480289.n2.nabble.com/…我不知道对不起
    • 是的,它正在工作。如果没有声音或噪音太大,谷歌语音 api 将报告“状态”:5。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-11
    • 1970-01-01
    • 1970-01-01
    • 2014-12-16
    • 1970-01-01
    • 1970-01-01
    • 2023-04-09
    相关资源
    最近更新 更多