Reputation: 75
VideoWriter videoWriter = new VideoWriter(outputFile, fourCC.toInt(), videoCapture.get(Videoio.CAP_PROP_FPS),
frameSize, true);
this return framesize as 0
Upvotes: 0
Views: 1639
Reputation: 6079
Solution At first you try to open the video and check if opened successfully as below:
VideoCapture capture = new VideoCapture(filePath);
if(!capture.isOpened()) {
System.out.println("Cannot open the video.");
return;
}
If it not returned, then it opened successfully, now you read the frame and display or at least check the height and width of the frame as below:
Mat frame = new Frame();
capture.read(frame);
int width = (int) capture.get(Videoio.CAP_PROP_FRAME_WIDTH);
int height = (int) capture.get(Videoio.CAP_PROP_FRAME_HEIGHT);
System.out.println("width = " + width );
System.out.println("height = " + height);
If everything goes well then, it is OK, you can use capture
and read the frames, if not working, go to your OpenCV
extracted folder and copy this line
C:\opencv\build\x64\vc14\bin
to your Environment Variable
and restart the your PC and try again.
Upvotes: 1