Ask Your Question

Camera input video compression

asked 2014-01-16 19:27:54 -0500

cmastudios gravatar image

updated 2014-01-17 11:08:05 -0500

unxnut gravatar image

I want the camera to compress the video using VideoCapture class. However, I cannot figure out how to set the property to enable camera to start compressing video. I have tried to set the property CV_CAP_PROP_FOURCC with VideoCapture::set but that requires a double as the parameter but CV_CAP_PROP_FOURCC is supposed to take char[4]. Can someone please help?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-01-18 03:34:18 -0500

Moster gravatar image

There is a function CV_FOURCC that can be used like that:

edit flag offensive delete link more


The OP wants to know how to use VideoCapture::set to set the FOURCC value. set requires a double as parameter but FOURCC is supposed to be a char array.

unxnut gravatar imageunxnut ( 2014-01-18 08:36:59 -0500 )edit

So where is the problem? This function returns the right value to be used according to the fourcc code. Its actually returns an integer, but that doesnt matter in this case. The VideoCapture class will take care of that

Moster gravatar imageMoster ( 2014-01-18 13:09:09 -0500 )edit

When attempting to set the property in the fashion VideoCapture::set(CV_CAP_PROP_FOURCC, CV_FOURCC('M','J','P','G')) it returns an error message: HIGHGUI ERROR: V4L: setting property #6 is not supported

unxnut gravatar imageunxnut ( 2014-01-18 16:13:40 -0500 )edit

Yes, because setting the compression mode is not supported by every backend.

Moster gravatar imageMoster ( 2014-01-19 14:15:27 -0500 )edit
Moster gravatar imageMoster ( 2014-01-19 14:17:56 -0500 )edit

Question Tools

1 follower


Asked: 2014-01-16 19:27:54 -0500

Seen: 2,235 times

Last updated: Jan 18 '14