Ask Your Question

FFmpeg performance decrease after OpenCV 2.4.6 to 2.4.9 upgrade on Windows

asked 2014-09-02 13:39:51 -0600

Will gravatar image

updated 2014-09-03 09:54:25 -0600

I have been using OpenCV's VideoCapture class to decode several H.264 camera streams simultaneously in a custom video viewer application. Unfortunately, when I upgraded OpenCV 2.4.6 to 2.4.9 my client reported a large slow down in the framerate at which the viewer shows frames. The framerates are roughly half of what they used to be (i.e., 30fps is now 15fps viewer speed).

I have since built FFmpeg from source myself, and am seeing very similar slow downs with my own build of FFmpeg 2.3.3 (as well as git head) (vs. 2.0.2, which is present in the OpenCV 2.4.9) using OpenCV's FFmpeg wrapper implementation.

EDIT: Both my FFmpeg build and program are built in Release mode with optimizations.

I was wondering if anyone on the OpenCV team happened to have custom build flags for 2.4.6, or if they are the same as is shown in the GitHub readme? Was libx264 possibly included in some of the previous builds; I understand that libx264 is a higher performance H.264 codec, so maybe that accounted for the speed decrease? Has anyone else noticed this slow down? It may not occur when reading a single stream, but it is definitely noticeable when decoding many. This may turn into an FFmpeg bug report, but just wanted to make sure I wasn't seeing things :D

edit retag flag offensive close merge delete


I noticed the same slowdown on the encoding side. It does seem to be FFmpeg related, since for me the fix was to use the old opencv_ffmpeg DLL. It should be compatible, so it's really just a matter of renaming the DLL and you should be fine.

glopes gravatar imageglopes ( 2014-09-03 15:48:12 -0600 )edit

@glopes Thanks for the info! Glad to know I'm not the only one experiencing the performance drop. I will definitely give your work around a shot. I'll also start gathering info to submit an FFmpeg bug report to hopefully fix the upstream problem.

Will gravatar imageWill ( 2014-09-05 18:59:58 -0600 )edit

@Will did you find anything else regarding this issue? I've pinpointed the change as definitely happening between 2.4.6 and 2.4.7. Changing the DLL fixes it, but the problem is that older versions can occasionally crash when opening MP4 files and the new ones don't... argh! can't find an ffmpeg version that just works!

glopes gravatar imageglopes ( 2015-03-01 05:48:47 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-09-03 01:43:26 -0600

jestshen gravatar image

Perhaps, you should change debug mode to release.

edit flag offensive delete link more


@jestshen Thanks for the idea, but unfortunately both my software and the FFmpeg library I built have optimizations enabled.

Will gravatar imageWill ( 2014-09-03 09:55:31 -0600 )edit

Question Tools


Asked: 2014-09-02 13:39:51 -0600

Seen: 1,398 times

Last updated: Sep 03 '14