当我使用示例代码中的 rpc 时,我可以获得镜头注释:
features = [
enums.Feature.LABEL_DETECTION,
enums.Feature.SHOT_CHANGE_DETECTION
]
operation = video_client.annotate_video(path, features=features, output_uri=json_file)
result = operation.result(timeout=90)
for i, shot in enumerate(result.annotation_results[0].shot_annotations):
start_time = (shot.start_time_offset.seconds +
shot.start_time_offset.nanos / 1e9)
end_time = (shot.end_time_offset.seconds +
shot.end_time_offset.nanos / 1e9)
print('\tShot {}: {} to {}'.format(i, start_time, end_time))
然而,由 GS 存储桶创建annotate_video()
并写入的 json 文件仅包含键segment_label_annotations
和shot_label_annotations
. 关键是一个空shot_annotations
列表。