Ask Your Question

Use VideoWriter class to save video in mp4 container.

asked 2014-03-19 12:48:41 -0600

us62 gravatar image

updated 2014-03-19 13:06:35 -0600

berak gravatar image

From the openCV documentation i found out that it only supports avi container to store video captured from the webcam. Is there a way where I can use an mp4 container?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-03-19 13:00:16 -0600

xaffeine gravatar image

OpenCV does not include state-of-the-art compression capability. The best approach may be to store in AVI and then recode offline to the format you want. Or, use a separate compression library.

edit flag offensive delete link more


My problem is that the video captured from the camera, if stored in an avi container, will lose the timestamp information since avi format does not support it. I need presentation timestamps for each frame.

us62 gravatar imageus62 ( 2014-03-19 13:10:35 -0600 )edit

You might need to use an actual video-capture toolkit. OpenCV does not have a priority on detailed capture-device support. What platform and type of camera are you using?

xaffeine gravatar imagexaffeine ( 2014-03-19 16:59:18 -0600 )edit

I am using C++ and a microsoft HD webcam...i need some way to have timestamps for each frame that i capture

us62 gravatar imageus62 ( 2014-03-21 13:00:02 -0600 )edit

I'm not sure it's 100% possible. You will probably have to use one of the Microsoft API. I've had trouble getting accurate time stamps. I suspect most people create them based on a system clock.

xaffeine gravatar imagexaffeine ( 2014-03-21 14:16:13 -0600 )edit

Question Tools

1 follower


Asked: 2014-03-19 12:48:41 -0600

Seen: 3,397 times

Last updated: Mar 19 '14