I followed https://cloud.google.com/speech/docs/getting-started and successfully ran
curl -s -k -H "Content-Type: application/json" \
-H "Authorization: Bearer access_token" \
https://speech.googleapis.com/v1beta1/speech:syncrecognize \
-d @sync-request.json
to get the expected output. However, now I am trying to do essentially the same thing but for a local flac file so I'm instead running:
curl -s -k -H "Content-Type: audio/x-flac" -H "Authorization: Bearer [my access key]"
https://speech.googleapis.com/v1beta1/speech:syncrecognize --data-binary @file.flac
and I'm getting a response of
{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unexpected token.\nfLaC\u0000\u0000\u0000\"\u0004\n^",
"status": "INVALID_ARGUMENT"
}
}
The google api developer console shows the message coming in but give me no further information to help me. I've also tried
wget --post-file file.flac --header="Content-Type: audio/x-flac; rate=16000" -O - "https://speech.googleapis.com/v1beta1/speech:syncrecognize?key=[my api key]"
and am also getting a 400 Bad Request error.
Has anyone successfully achieved what I'm shooting for? All of the examples I can find are for either using the api for an uploaded file or using some libraries, as opposed to a minimalistic curl or wget request.