Saturday, 15 September 2012

How to change libx264 profile when using ffmpeg backend of OpenCV -


OpenCV 3.0.0 for writing a video with

I VideoWriter vw ("out.avi", VideoWriter) I am using beta. :: four cc ('h', '2', '6', '4'), 24, frame. Size ());

This PhamPackage calls backend (avcodec version) 56.26.100), which calls 2 GBX 264 (Build 142). However, apparently it is not possible to specify a libx264 profile from OpenCV, and the default bitrate for my application is very low.

"text">

Meanwhile, I got the answer myself: the default CRF is defined as 23 in the line 1232 of module / video / src / cap_ffmpeg_impl.hpp (on OpenCV 3.0.0 Beta):

  Av_opt_set (c-> gt; priv_data, "crf", "23", 0);  

Change the number to the value of your choice. For this it is necessary to reconstruct OpenCV and it is a global setting, as long as the video audio module does not implement the codec option properly.


1 comment: