Ask Your Question

openh264 - bEnableFrameSkip=0, bitrate can't be controlled

asked 2016-04-09 20:50:16 -0500

Prakash gravatar image

updated 2016-04-09 20:59:06 -0500

there are a lot of questions asked regarding opencv + H.264 but none of them gave detailed explanation.

i am using openh264(openh264-1.4.0-win32msvc.dll) along with opencv 3.1(custom build with cmake having ffmpeg enabled) in visual studio, i wanted to save video coming from webcam in mp4 format with H.264 compression

VideoWriter write = VideoWriter("D:/movie.mp4", CV_FOURCC('H', '2', '6', '4'), 10.0, cv::Size(192, 144), true);

before using openh264, in console window i was seeing an warning message "Failed to load openh264 library : openh264-1.4.0-win32msvc.dll please check your environment and/or download from here: (also video was not been saved)

so i downloaded the dll & kept in a folder with my program file(exe) now when i run the program, i'm seeing different error "[OpenH264] this = 0x0DE312C0, warning: bEnabledFrameSkip=0, bitrate can't be controlled for RC_QUALITY_MODE and RC_TIMESTAMP_MODE without enabling skip frame" (now video is saved, but size is very high! bit rate is around 1200 Kbps)

for me, the sole purpose of using h264 is to reduce the file size.. i think i may have to build openh264 myself with some changes to remove this error, can anyone guide me how? or tell me if there is a way to reduce bit rate somehow through code?

Thanks & Regards

P.S: I tried giving -1 instead of CV_FOURCC(), 'installed codecs' window in my system showed up, i couldn't find h264 or x264 or h264vfw even though i have installed variety of codec packs & h264 from here

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-04-09 23:01:56 -0500

Tetragramm gravatar image

I can help a little bit, but I don't have all the answers.

The reason you were getting the "Failed to load openh264 library" error is because you didn't have it added to the environment. You go to Control Panel->System and Security->System On the left side is Advanced System Settings. Then click on Environment Variables, and in the System Variables section, add OPENH264_LIBRARY_PATH with a value of the location of the .dll

The rest is an option in the OpenCV_ffmpeg module that comes with OpenCV. Unfortunately, it only comes pre-compiled, and you can't get to wherever it sets the option.

I do hope some future version fixes this, since I would like to be able to control the bit-rate too.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-04-09 20:50:16 -0500

Seen: 1,585 times

Last updated: Apr 09 '16