c - OpenCV Video capture and fps problem -


I'm capturing video from my webcam using OpenCV on MacOSX. It works fine, but when I If I try to play my captured video on Quicktime, then it plays very fast. That is, I capture with the camera for 10 seconds, but when I play on Quicktime, the video is 2 seconds. I

I have tried to change the FPS from 25 to 10 and it works very well , But I'm sure this is not the right process:

  CVVideoWriter * writer = 0; Int isColor = 1; Int fps = 25; Int Frame W = 640; // 744 inch frame for firewire camera H = 480;  

The problem is that I still have to capture the webcam, but the real slope of the program is to capture the image from an external source connected to my Mac. / P>

I am using this code to capture:

 for  (;;) {cvGrabFrame (capture) image = cvRetrieveFrame (capture); CvWriteFrame (author, image); }  

Any hint? I'm also showing webcam output on cvNamedWindow, how can I improve the quality in this window?

Thanks for the many!

Andrea!

It is possible that compressing the captured video and saving it in the file is very CPU intensive If this is the case then you actually only see 10 FPS in the CNNWWO and only 10 fps are written in the file. Specifying 25 FPS in the file will naturally give some speed to the playback.

To see if you really have a problem, you can try saving image data only in memory. I have not tried to put it out, but I think you will do this with cvCloneImage ().

You can also try some other format with less CPU overhead to save your video:

  CV_ForCC ('P', 'I', ' M ',' 1 ') = MPEG-1 codec cv_forc (' m ',' j ',' p ',' g ') = speed-jpeg codec (does not work well) CV_FOURCC (' M ', 'P', '4', '2') = MPEG-4.2 codec CV_FOURCC ('D', 'I', 'V', '3') = MPEG-4.3 codec cv_forc ('d', 'i' 'V', 'X') = MPEG-4 codec CV_FroCC ('U', '2', '6', '3') = H263 codec cv_forc ('I', '2', '6', '3 ') = H263I Odek CV_FOURCC ( 'F', 'L', 'V', '1') = FLV1 codec  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -