Specify ffmpeg encoder in VideoCapture

asked 2017-03-20 13:52:20 -0500

everphilski gravatar image

I'm using an Orange Pi with a built in CSI webcam. On the command line with ffmpeg I can get 30+ frames a second no problem using the hardware-accelerated cedrus encoder.

From OpenCV, using the v4l2 bindings is much slower - I get about 10 frames per second in the best case. And it's no better if I specify CAP_FFMPEG because it isn't using the hardware-accelerated encoder.

Is there a way to either (a) specify an encoder in OpenCV VideoCapture (API suggests no) (b) a straightforward way to pipe output from an ffmpeg process to OpenCV VideoCApture (c) is there a third method I'm missing?

thanks philip

edit retag flag offensive close merge delete


" is there a third method I'm missing?" -- use libffmpeg directly, to aqcuire images, convert them to cv::Mat

(in other words, - sidestep opencv's VideoCapture class, which is a nice commodity, but for sure not optimal in all cases)

berak gravatar imageberak ( 2017-03-20 13:54:55 -0500 )edit

berak - thanks. I can't find good documentation on this. Is there an example you could point me to?

everphilski gravatar imageeverphilski ( 2017-03-23 23:51:33 -0500 )edit

sorry, no i can't.

berak gravatar imageberak ( 2017-03-24 01:23:37 -0500 )edit