Ask Your Question

Force opencv to use a particular decoder

asked 2013-03-15 04:17:45 -0600

Hello, everybody! I have a problem. When I keep my application running, after some hours of running it crashes and in log I see errors from h264 decoder. Can I get a better (more stable) h264-decoder from somewhere and force opencv to use it?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-03-15 05:11:18 -0600

You can basically use every decoder by using the specified fourcc code. You can choose them from this list:

Be sure to have the decoder installed on your system, and it will work without problem. However, when you say your application crashes after some time, I would consider looking into memory leaks. Possibly you are allocating memory somewhere and not manually deallocating it anymore, slurping up your memory bit by bit.

edit flag offensive delete link more


I think I haven't posed my question very clearly. I have h264 decoder installed. But, as I said, current decoder crashes after some time. It can be a memory leak, but memory looks fine in task manager. I think, it has to do with decoder implementation. As I said, if I get another h264 decoder, for example from Elecard or from Main-Concept, can I force OpenCV to use the new h264 decoder?

TVMSiber gravatar imageTVMSiber ( 2013-03-15 06:12:29 -0600 )edit

YESH, like I said, if the decoder is supported by the fourcc library, since you have to specify which decoder you want to use in the command for video writing :

CV_FOURCC('D','I','V','4'), in this case I have added the MPEG4 DIVX decoder because H264 gave problems on my windows machine also.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-03-15 06:39:24 -0600 )edit

answered 2013-11-29 08:34:42 -0600

a_w_baker gravatar image

I am facing a similar issue. It seems that if you install a different set of codec then the machine will use the different set. This is my experience. The issue that I seem to have is that the different set is not always found and so my code will intermittently crap out on different formats (e.g., MP4).

I believe that using the fourcc function is for encoding and not decoding.

If you solved the problem would you share your solution.

Thank you,


edit flag offensive delete link more

Question Tools


Asked: 2013-03-15 04:17:45 -0600

Seen: 1,096 times

Last updated: Nov 29 '13