Search code examples
c++opencvcomputer-visionvideo-processingvideo-encoding

opencv rewrite a compressed video file


Heylo!

I have a video file (unknown compression) of about 500MB in size. I am experimenting with OpenCv and try to discard some frames and resave that file.

When run the program for ~3 minutes (the original file lasts for ~1h) i already have 700MB file :(

How can I maintain the original file size and just discard some frames?

Thx!!!

ps: i am trying to get the original codec using this code:

int ex = static_cast<int>(inputVideo.get(CV_CAP_PROP_FOURCC));

but apparently ex = 0 ??


Solution

  • OpenCV doesn't support all types of containers/codecs, for instance MKV is not supported. This page has an interesting info on the subject.

    And this list shares some of the FourCC codes that are currently supported.