Video Recorder without Compression Dialog [closed]

asked 2014-12-02 07:24:23 -0600

R gravatar image

updated 2015-10-06 13:40:21 -0600

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': image description

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:

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by berak
close date 2014-12-02 14:35:08.469442

Comments

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).

berak gravatar imageberak ( 2014-12-02 14:34:29 -0600 )edit