批量提取视频帧并保存为文件 - ExtractFramesToFiles
函数简介
批量提取视频帧并保存为文件。
接口名称
ExtractFramesToFiles
DLL调用
int32_t ExtractFramesToFiles(int64_t instance, int64_t videoHandle, int32_t startFrame,
int32_t endFrame, int32_t step, string outputDir,
string imageFormat, int32_t jpegQuality)
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| videoHandle | 长整数型 | 视频句柄 |
| startFrame | 整数型 | 起始帧索引 |
| endFrame | 整数型 | 结束帧索引(-1表示到视频末尾) |
| step | 整数型 | 帧间隔(1表示每帧都提取) |
| outputDir | 字符串 | 输出目录 |
| imageFormat | 字符串 | 图像格式("png"、"jpg"等) |
| jpegQuality | 整数型 | JPEG质量(0-100) |
示例
int64_t instance = CreateCOLAPlugInterFace();
int64_t videoHandle = OpenVideo(instance, "test.mp4");
int32_t count = ExtractFramesToFiles(instance, videoHandle, 0, 100, 5, "C:/frames", "png", 90);
printf("提取了 %d 帧\n", count);
CloseVideo(instance, videoHandle);
DestroyCOLAPlugInterFace(instance);
返回值
返回提取的帧数,失败返回0。
