Video Recorder without Compression Dialog [closed]
Hi, (I am new to the OpenCV scene so bear with me)
I have created a face detection program which uses the video stream of a webcam (this works fine).
For test/evaluation: I need to store some footage as a video on my computer. I have gotten this to work for short periods just fine (using FrameRecorder). When I left the program for 3 hours the .avi file was created but cannot be played.
My attempt to solve this is to use a Timer with TimerTasks to store a new video every 15 minutes.
PROBLEM: When default FrameRecorder is created, a dialog asks for user input to determine 'Video Compression'/'Compressor':
This is not good enough as the java program will be running in the background.
I have tried determining the video codec but this causes a FrameRecorderException: "cvCreateVideoWriter(): Could not create a writer" on the call recorder.start().
How do I avoid this exception? Or how do I avoid the dialog? Where does the dialog come from?
Code: FrameRecorder recorder = FrameRecorder.createDefault("out.avi", width, height); recorder.setVideoCodec(avcodec.AV_CODEC_ID_MPEG4); //doesn't crash without this recorder.setFrameRate(5); recorder.setFormat("avi"); recorder.setPixelFormat(avutil.AV_PIX_FMT_YUV420P); //crashes with or without this recorder.start();
Exception:
sorry dear, opencv does not support writing videos from java, and the FrameRecorder api is not part of opencv.
you probably are confusing it with javacv (which is a 3rd party wrapper around some subset of opencv).