Re: how to post mp3 as url? always get 'Invalid video file' (490 Views)
Reply
Level 1
Posts: 2
Registered: ‎02-03-2017
Message 1 of 4 (536 Views)

how to post mp3 as url? always get 'Invalid video file'

[ Edited ]

i send request from the browser:

https://api.idolondemand.com/1/api/async/recognizespeech/v1?url=myaudio.mp3&apikey=*

 

and after:

https://api.idolondemand.com/1/job/result/myjobid?apikey=*

 

but always i receive this:

{
    "actions": [
        {
            "errors": [
                {
                    "error": 5014,
                    "reason": "Invalid video file"
                }
            ],
            "status": "failed",
            "action": "recognizespeech",
            "version": "v1"
        }
    ],
    "jobID": "myjobid",
    "status": "failed"
}

 

Level 2
Posts: 7
Registered: ‎06-19-2014
Message 2 of 4 (511 Views)

Re: how to post mp3 as url? always get 'Invalid video file'

Hi nola,

 

It looks like you might need to use the file parameter instead of the url parameter.

 

The url parameter must take a valid URL pointing to an audio/video file which is accessible over the internet. For example if you were to paste the value of the url parameter into your web browser it should start playing the audio/video file.

 

The example below performs Recognise Speech on the following audio file https://www.havenondemand.com/sample-content/videos/hpnext.mp4. The URL has to be URL encoded if you include it in the query string.

 

https://api.havenondemand.com/1/api/async/recognizespeech/v1?url=https%3A%2F%2Fwww.havenondemand.com%2Fsample-content%2Fvideos%2Fhpnext.mp4&apikey=<APIKEY>

 

If you want to use the Recognise Speech API on an audio file stored locally such as on your computer then you will have to upload the file using the file parameter.

 

Here is an example using curl.

 

curl -X POST --form "file=@myaudio.mp3" --form "apikey=<APIKEY>" https://api.havenondemand.com/1/api/async/recognizespeech/v1

 

Please let me know if you need any more assitance.

 

 

Peter

Level 1
Posts: 2
Registered: ‎02-03-2017
Message 3 of 4 (495 Views)

Re: how to post mp3 as url? always get 'Invalid video file'

the mp3 url needs to be ssl (https://) ?

when i try http:// its say 'invalid' but https links works.

Highlighted
Level 2
Posts: 7
Registered: ‎06-19-2014
Message 4 of 4 (490 Views)

Re: how to post mp3 as url? always get 'Invalid video file'

The URL parameter does not need to use HTTPS. If you try the example I provided with HTTP instead it still works.

 

My best guess is that the mp3 your are referring to is only accessible over HTTPS.

† The opinions expressed above are the personal opinions of the authors, not of HPE. By using this site, you accept the Terms of Use and Rules of Participation