Reputation: 23
Hi, I'm following the instructions here to request an video annotation processing.
curl -s -H 'Content-Type: application/json' -H 'Authorization: Bearer ACCESS_TOKEN_PASTED_HERE' 'https://videointelligence.googleapis.com/v1/videos:annotate' -d @request.json
My json file includes the public link to the video file stored in the project bucket.
{
"inputUri":"https://storage.googleapis.com/PROJECT_URL_HERE/video.mp4",
"features": [
"LABEL_DETECTION"
]
}
I'm supposed to get a response with the operation name:
The Video Intelligence API creates an operation to process your request. The response includes the operation name:
{ "name": "us-west1.18358601230245040268" }
The actual result I get is nothing, not even an error. Just a moment of waiting followed by a blank command line.
My dashboard shows a successful creation of my credentials but shows no activity on the Video Intelligence API.
Thanks!
Upvotes: 1
Views: 328
Reputation: 7058
The inputUri
field must be a valid GCS path in the format gs://BUCKET_NAME/path/to/video
as explained here, and not the https://storage.googleapis.com
link you are using. Otherwise, it should return google.rpc.Code.INVALID_ARGUMENT
. If you don't get any output maybe it's a syntax error (see steps below). In my case, it reads:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}
If, instead, you use one of the public examples in gs://
format in your request.json
:
{
"inputUri":"gs://cloud-ml-sandbox/video/chicago.mp4",
"features": [
"LABEL_DETECTION"
]
}
and then activate the service account and request the video annotations by running the following:
gcloud auth activate-service-account --key-file=/path/to/credentials.json
curl -s -H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://videointelligence.googleapis.com/v1/videos:annotate" \
-d @request.json
you'll get a response like:
{
"name": "europe-west1.16***************80"
}
Once you have the operation name you can check the status with:
curl -s -H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://videointelligence.googleapis.com/v1/operations/europe-west1.16***************80" > result.json
Verify that it is done with:
cat result.json | grep done
If finished, that should output:
"done": true,
and result.json
will contain the requested annotations:
"annotationResults": [
{
"inputUri": "/cloud-ml-sandbox/video/chicago.mp4",
"segmentLabelAnnotations": [
{
"entity": {
"entityId": "/m/0pg52",
"description": "taxi",
"languageCode": "en-US"
},
...
Upvotes: 2