读取指定索引的帧 - ReadFrameAtIndex
函数简介
读取指定索引的帧。
接口名称
ReadFrameAtIndex
DLL调用
int64_t ReadFrameAtIndex(int64_t instance, int64_t videoHandle, int32_t frameIndex)
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| videoHandle | 长整数型 | 视频句柄 |
| frameIndex | 整数型 | 帧索引(从0开始) |
示例
int64_t instance = CreateCOLAPlugInterFace();
int64_t videoHandle = OpenVideo(instance, "test.mp4");
int64_t imageHandle = ReadFrameAtIndex(instance, videoHandle, 100);
if (imageHandle != 0) {
printf("读取第100帧成功,图像句柄: %lld\n", (long long)imageHandle);
// 返回的图像句柄由内部管理,不需要手动释放
} else {
printf("读取帧失败\n");
}
CloseVideo(instance, videoHandle);
DestroyCOLAPlugInterFace(instance);
返回值
图像句柄(BGRA格式),失败返回0。
注意事项
- 返回的图像句柄由内部管理,不需要手动释放
- frameIndex从0开始,必须小于总帧数
