保存指定帧为图片文件 - SaveFrameAtIndex
函数简介
保存指定帧为图片文件。
接口名称
SaveFrameAtIndex
DLL调用
int32_t SaveFrameAtIndex(int64_t instance, int64_t videoHandle, int32_t frameIndex,
string outputPath, int32_t quality)
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| videoHandle | 长整数型 | 视频句柄 |
| frameIndex | 整数型 | 帧索引 |
| outputPath | 字符串 | 输出文件路径 |
| quality | 整数型 | 图片质量(对于JPEG,范围0-100) |
示例
int64_t instance = CreateCOLAPlugInterFace();
int64_t videoHandle = OpenVideo(instance, "test.mp4");
int32_t result = SaveFrameAtIndex(instance, videoHandle, 100, "C:/frame100.png", 90);
if (result == 1) {
printf("保存第100帧成功\n");
} else {
printf("保存失败\n");
}
CloseVideo(instance, videoHandle);
DestroyCOLAPlugInterFace(instance);
返回值
- 0: 失败
- 1: 成功
