Google Cloud Vision处理低帧率iPhone MP4视频时时间偏移异常
问题:Google Cloud Video Intelligence处理iPhone录制低帧率MP4时时间偏移计算错误
问题现象
- 处理iPhone(Safari录制)的低帧率(约5fps)MP4视频时,返回结果中的
endTimeOffset和检测对象的timeOffset存在明显偏差 - 示例:一段实际时长4.5秒、帧率5.236fps的视频,处理后
endTimeOffset仅为0.834166s,与实际时长不符 - 该问题在时长超过15秒的MP4视频中极易复现,但同参数的WEBM视频处理结果正常
检测结果示例
{ "annotationResults": [ { "segment": { "endTimeOffset": "0.834166s", "startTimeOffset": "0s" }, "inputUri": "/obfuscated_path/c9bb312c-77ef-4fc2-a577-698e10797316.mp4", "frameLabelAnnotations": [ { "entity": { "entityId": "/m/0643t", "description": "personal computer", "languageCode": "en-US" }, "frames": [ { "confidence": 0.5484067, "timeOffset": "1s" } ], "categoryEntities": [ { "entityId": "/m/01m3v", "description": "computer", "languageCode": "en-US" } ] }, // 其余检测结果省略 ] } ] }
MP4文件属性
- 分辨率:1280x720
- 帧率:5.236fps
- 时长:4.5s
执行检测的Java代码片段
// --snip // Set the label detection mode LabelDetectionConfig config = LabelDetectionConfig.newBuilder() .setLabelDetectionMode(LabelDetectionMode.FRAME_MODE) .build(); // Set the video context with the above configuration VideoContext context = VideoContext.newBuilder().setLabelDetectionConfig(config).build(); AnnotateVideoRequest request = AnnotateVideoRequest.newBuilder() .setInputUri(videoObj.getUri()) .addFeatures(Feature.LABEL_DETECTION) .setVideoContext(context) .build(); // -- snip VideoIntelligenceServiceClient client = VideoIntelligenceServiceClient.create(); client.annotateVideoAsync(request);
疑问
这是MP4格式的已知问题吗?是否有解决方法?
内容的提问来源于stack exchange,提问作者S. D.
相关产品推荐
相关产品推荐

