Mat frame;
char outfine[400];
VideoCapture cap;
VideoWriter writer;
cap.open("E:\欣奕华\项目\OPENCV\Video\ComposeandDecompose\hxy.mp4");
if (!cap.isOpened())
return;
int totalFrame = cap.get(CAP_PROP_FRAME_COUNT);
for (int i = 0; i < totalFrame; i++)
{
cap >> frame;
if (frame.empty())
break;
sprintf_s(outfine, "E:\欣奕华\项目\OPENCV\Video\ComposeandDecompose\%d.jpg", i);
imwrite(outfine, frame);
imshow("video", frame);
waitKey(30);
}
cap.release();
destroyAllWindows()