PyGST GStreamer corrupted file with google speech api

438 views Asked by At

on a raspberry pi i am trying to record audio with gstreamer as a .flac or .wav file.

I want the audio file to be send to the inoffical google speech api server

But my gstreamer pipeline output as a 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

or as a 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

get always rejected.

Error: (wrong file format or wrong samplerate)

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

Normal recording with sox and encoding with ffmpeg or flac is working so i guess the output file from gstreamer is somehow corrupted or that iam missing something

EDIT: Pipeline running with -v http://hastebin.com/vovefeyewe.vbs added a queue after alsasrc but still the same problem

SOLVED

Additional parameters solved the problem

 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

and If there is there no voice or only a random noise google will reject the file with the (wrong format error)

1

There are 1 answers

3
martien9 On BEST ANSWER

Can you add -v option in your pipeline and send the output?