I'm trying to set the CV_CAP_PROP_FOURCC property on my VideoCapture object. However, I cannot find the CV_FOURCC() function usually used to convert from 4 chars to an int.
I tried the following:
this.opencv.vCap.set(cv.CV_CAP_PROP_FOURCC, cv.VideoWriter.fourcc("mjpg"));
But it gives me the following error:
VideoCapture::Set - expected arg 0 to be of type: INT
Ideas?
Yeah, CV_CAP_PROP_FOURCC is from the old C API, which I didn't export, thus it's undefined. In the C++ API it is simply CAP_PROP_FOURCC, so cv.CAP_PROP_FOURCC that should work.
You can have a look at the file, where I export all the CAP_PROPs: videoCaptureProps.cc .
Oh, right! I thought the problem was with this part: cv.VideoWriter.fourcc("mjpg"). In any case, when I'm looking for a function/property what should I use as a reference? The latest C++ API?
Thanks again for your help.
For future reference (it may help someone down the road), the character code should be in caps. This is the full line to get it working:
vCap.set(cv.CAP_PROP_FOURCC, cv.VideoWriter.fourcc("MJPG"));
P.S. MJPG provides much better throughput (resolution/frame rate) than the other ones. You have to consider that USB2's bandwidth is rather limited.
Oh, right! I thought the problem was with this part: cv.VideoWriter.fourcc("mjpg"). In any case, when I'm looking for a function/property what should I use as a reference? The latest C++ API?
Currently the entire API and usage is documented here: https://justadudewhohacks.github.io/opencv4nodejs/docs/
I agree it's a little inconvenient, but a webpage for this project will follow soon with hopefully a better overview of the documentation.
Ok, awesome. I'm really beginning to like OpenCV, thanks to your nice library!
Most helpful comment
Yeah,
CV_CAP_PROP_FOURCCis from the old C API, which I didn't export, thus it's undefined. In the C++ API it is simplyCAP_PROP_FOURCC, socv.CAP_PROP_FOURCCthat should work.You can have a look at the file, where I export all the CAP_PROPs: videoCaptureProps.cc .