Ask Your Question

default codec [closed]

asked 2015-10-21 08:44:48 -0500

srs gravatar image

updated 2015-10-21 08:45:53 -0500

Hello. I am using 2.4.0.* version of emgucv in a c# .net environment. I want to save to file a truly uncompressed video. If I put a -1 in the fourcc in VideoWriter, it pops a dialog and then I can select "full frame/uncompressed". But I dont want to display a dialog. I want to select uncompressed without dialog. I have tried using 0 for FourCC. But that doesnt give me a fully uncompressed video. I believe there is some compression. I only know this by comparing the file generated by this method vs the dialog with same recording time. If I use the VideoWriter constructor that doesnt specify the FourCC, what default codec does it use and can this default be changed? Also if anyone know another way to save uncompressed without dialog pop-up, please share. Thanks.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by LorenaGdL
close date 2015-10-29 06:17:16.756346

2 answers

Sort by ยป oldest newest most voted

answered 2015-10-21 10:59:13 -0500

LorenaGdL gravatar image

updated 2015-10-21 11:00:53 -0500

First of all, this forum gives no support to OpenCV wrappers like EgmuCV (please see FAQ). Next time, please adress your question to the proper forum (probably here).

However, as I feel the question is not related with the wrapper and I think I can help a bit, here I go:

  1. Though as you may have seen in documentation the fourcc parameter is an integer, knowing exactly what codec belongs to each number might be difficult. What you should passed as the fourcc parameter (at least in regular OpenCV, guess it's the same in EgmuCV) is the corresponding fourcc code such as CV_FOURCC('M', 'J', 'P', G'). This is explained in documentation, where you also have a link to a bunch of these codes. The pop-window only appears when choosing -1, so once you input a specific code it won't appear anymore.

  2. The "default" full frame/uncompressed codec is OS dependant (afaik, though I may be wrong). One way to determine what it is being used could be to use some external free software such as MediaInfo, which gives low-level information about videos, including the used codec. So, you can try to save a video with that full frame/uncompressed codec, then retrieve the real name of such codec using MediaInfo, and finally get rid of the -1 and substitute it for the corresponding fourcc code.

  3. If the "default" uncompressed codec is unsuitable for you, you can always install in your computer alternative codecs to get the desired result. Everything installed in your computer will appear in the pop-up window when using -1 in the fourcc parameter. Also note that, obviously, you can't use a codec that is not present in your computer (VideoWriter won't write).

  4. About the default VideoWriter constructor with no parameters, it does not use any default codec because you need to use function open afterwards to initialize it, which does need the fourcc code (plus the filename, fps and size of the video).

Hope it helped a bit

edit flag offensive delete link more

answered 2015-10-28 09:47:49 -0500

srs gravatar image

Thank you for your answer. I downloaded MediaInfo to get he info I need. Thank you!!!

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-10-21 08:44:48 -0500

Seen: 516 times

Last updated: Oct 28 '15