标签: video-intelligence-api

如何获取Google Cloud Storage中存在的视频的视频时长

我已将视频上传到Google的Cloud Storage存储桶,并在Video Intelligence API中引用了它们的URL。当我尝试获取上载视频的视频时长时,Video Intelligence API不会返回任何内容。

这是我使用的代码:

require "google/cloud/video_intelligence"

video_intelligence_client = Google::Cloud::VideoIntelligence.new
features_element = :LABEL_DETECTION
features = [features_element]

operation = video_intelligence_client.annotate_video input_uri: input_uri, features: features
p "PROCESSING......"
p operation
raise operation.results.message? if operation.error?

operation.wait_until_done!
metadata = operation.metadata
puts metadata
Run Code Online (Sandbox Code Playgroud)

使用Video Intelligence API是否可以获取视频时长?另外,我应该如何从Google Cloud Storage API获取它?

google-cloud-storage google-cloud-platform video-intelligence-api

5
推荐指数
1
解决办法
88
查看次数

向GCP Video Intelligence API发出请求时,权限被拒绝

因此,我可以使用快速入门中提供的示例视频向视频智能api发出有效请求。https://cloud.google.com/video-intelligence/docs/getting-started我也尝试了许多不同的方式对api进行身份验证。我正在使用的API令牌是从控制台中的“凭据”页面创建的。没有将它绑定到视频API的选项,因此我认为它应该可以自动工作。我的帐户已启用该API。

export TOKEN="foobar"
curl -XPOST -s -k -H"Content-Type: application/json" "https://videointelligence.googleapis.com/v1beta1/videos:annotate?key=$TOKEN" --data '{"inputUri": "gs://custom-bucket/IMG_3591.mov", "features": ["LABEL_DETECTION"]}'
{
  "error": {
    "code": 403,
    "message": "The caller does not have permission",
    "status": "PERMISSION_DENIED"
  }
}

curl -XPOST -s -k -H"Content-Type: application/json" "https://videointelligence.googleapis.com/v1beta1/videos:annotate?key=$TOKEN" --data '{"inputUri": "gs://cloud-ml-sandbox/video/chicago.mp4", "features": ["LABEL_DETECTION"]}'
{
  "name": "us-east1.18013173402060296928"
}
Run Code Online (Sandbox Code Playgroud)

更新:

我将该文件设置为公共文件,并且可以正常工作。但是我需要以私有身份访问此文件,因此我向服务帐户授予了对该文件的访问权限,并尝试获取建议的API密钥。

export TOKEN="$(gcloud auth print-access-token)"
curl -XPOST -s -k -H"Content-Type: application/json" "https://videointelligence.googleapis.com/v1beta1/videos:annotate?key=$TOKEN" --data '{"inputUri": "gs://custom-bucket/IMG_3591.mov", "features":["LABEL_DETECTION"]}'
{
  "error": {
    "code": 400,
    "message": "API key not valid. Please pass a valid …
Run Code Online (Sandbox Code Playgroud)

google-cloud-platform gcp video-intelligence-api

3
推荐指数
1
解决办法
2387
查看次数

猫鼬错误:检测到循环依赖

我编写了一项使用Google Cloud Video Intelligence分析视频的服务

\n

我用mongoose将分析结果保存到MongoDB中

\n

这是我使用的模型(我简化了一切以避免混淆):

\n
// Video.js\n\nconst mongoose = require(\'mongoose\');\n\nconst videoSchema = new mongoose.Schema({\n    analysis_progress: {\n        percent: { type: Number, required: true },\n        details: {}\n    },\n    status: {\n        type: String,\n        enum: [\'idle\', \'processing\', \'done\', \'failed\'],\n        default: \'idle\'\n    }\n});\n\nmodule.exports = mongoose.model(\'Video\', videoSchema);\n\n
Run Code Online (Sandbox Code Playgroud)\n

当分析操作结束时,我调用下面的函数并update像这样运行:

\n
\nfunction detectFaces(video, results) {\n   //Build query\n    let update = {\n        $set: {\n            \'analysis_results.face_annotations\': results.faceDetectionAnnotations // results is the the test result\n        }\n    };\n\n    Video.findOneAndUpdate({ _id: video._id }, update, { …
Run Code Online (Sandbox Code Playgroud)

mongoose mongodb node.js video-intelligence-api

3
推荐指数
1
解决办法
4504
查看次数