Hello all,
I want to record the frames I'm processing in my android smarthpone but nothing is being saved. I'm not getting any error either...
First I created the object in the MainActivity:
private VideoWriter videoWriter;
In the method onCreate I've initialized it and opened
videoWriter = new VideoWriter("saved_video.avi", VideoWriter.fourcc('m','j','p','g'), 25.0D, new Size(mOpenCvCameraView.getWidth(),mOpenCvCameraView.getHeight())); videoWriter.open("saved_video.avi", VideoWriter.fourcc('m','j','p','g'), 25.0D, new Size(mOpenCvCameraView.getWidth(),mOpenCvCameraView.getHeight()));
In the method onCameraFrame I've put the following
if(!videoWriter.isOpened()){ Log.w("opened video", "OPENED"); videoWriter.open("saved_video.avi", VideoWriter.fourcc('m','j','p','g'), 25.0D, new Size(mOpenCvCameraView.getWidth(),mOpenCvCameraView.getHeight())); videoWriter.write(frame); } else if(frameCounter<50) { videoWriter.write(frame); Log.w("saved frame", "SAVED"); } }
Every frame I run returns videoWriter.isOpened()==false. I'm not using any ".release" method because I didn't know where to put it.
Thanks in advance!