我开始得到:
concurrent.futures._base.TimeoutError: Operation did not complete within the designated timeout.
(即使是 5 秒的视频,我也有 timeout=1000)
它从 10 月 5 日开始(在此之前它工作了几个月)。
我使用的是:python:3.8.7,pip install google-cloud-videointelligence==2.3.3,Google cloud,在 Cloud Run 上运行 - python:3.8.7-slim
代码:
from google.cloud import videointelligence
video_client = videointelligence.VideoIntelligenceServiceClient()
context = videointelligence.VideoContext(
segments=None
)
features= [ videointelligence.Feature.LABEL_DETECTION,
videointelligence.Feature.TEXT_DETECTION,
videointelligence.Feature.OBJECT_TRACKING]
request = videointelligence.AnnotateVideoRequest(
input_uri="gs://"+path,
video_context=context,
features=features
)
operation = video_client.annotate_video(request)
result = operation.result(timeout=1000)
result = json.loads(MessageToJson(result._pb))