OpenCV Video capture and fps problem

前端 未结 4 1757
时光取名叫无心
时光取名叫无心 2021-01-06 23:53

I\'m capturing video from my webcam using OpenCV on MacOSX. It works fine but when I try to play on QuickTime my captured video it plays too fast. i.e. I capture from camera

4条回答
  •  一生所求
    2021-01-07 00:11

    Could be that compressing the captured video and saving it to a file is too CPU intensive. If that's the case then you really only see 10 FPS in the cvNamedWindow, and only 10 FPS are written to the file. Specifiying 25 FPS in the file will naturally speed playback up some.

    To see if that's really your problem, you could try to save the image data only in memory. I've not tried it out, but I think you'd do that with cvCloneImage().

    You could also try some other format with a lower CPU overhead to save your video:

    CV_FOURCC('P','I','M','1')    = MPEG-1 codec
    CV_FOURCC('M','J','P','G')    = motion-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_FOURCC('D', 'I', 'V', 'X') = MPEG-4 codec
    CV_FOURCC('U', '2', '6', '3') = H263 codec
    CV_FOURCC('I', '2', '6', '3') = H263I codec
    CV_FOURCC('F', 'L', 'V', '1') = FLV1 codec
    

提交回复
热议问题