Witam
Piszę program do nagrywania obrazu z kamerki zamontowanej w laptopie (narazie)

#include "wideowindow.h"
#include "ui_wideowindow.h"
#include "qDebug"

wideoWindow::wideoWindow(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::wideoWindow)
{
    ui->setupUi(this);
    //camera = cvCreateCameraCapture(0);
    camera = cvCreateFileCapture("cat.avi");
    int  w,h,f;
    CvSize size = cvSize (
        (int)cvGetCaptureProperty(camera,CV_CAP_PROP_FRAME_WIDTH),
        (int)cvGetCaptureProperty(camera,CV_CAP_PROP_FRAME_HEIGHT)
    );
    cvSetCaptureProperty(camera,CV_CAP_PROP_FPS,25);
    writer = cvCreateVideoWriter(
        "plik.avi",
        -1,
        25, // set fps
        size
    );
    startTimer(100);
}

wideoWindow::~wideoWindow()
{
    delete ui;
    cvReleaseCapture(&camera);
    cvReleaseVideoWriter( &writer );
}

void wideoWindow::timerEvent(QTimerEvent*) {
    image1=cvQueryFrame(camera);
    this->putImage(image1);
    this->saveImage(image1);
}

void wideoWindow::putImage(IplImage *cvimage) {
    int cvIndex, cvLineStart;
    // switch between bit depths
    switch (cvimage->depth) {
        case IPL_DEPTH_8U:
            switch (cvimage->nChannels) {
                case 3:
                    if ( (cvimage->width != image.width()) || (cvimage->height != image.height()) ) {
                        QImage temp(cvimage->width, cvimage->height, QImage::Format_RGB32);
                        image = temp;
                    }
                    cvIndex = 0; cvLineStart = 0;
                    for (int y = 0; y < cvimage->height; y++) {
                        unsigned char red,green,blue;
                        cvIndex = cvLineStart;
                        for (int x = 0; x < cvimage->width; x++) {
                            // DO it
                            red = cvimage->imageData[cvIndex+2];
                            green = cvimage->imageData[cvIndex+1];
                            blue = cvimage->imageData[cvIndex+0];

                            image.setPixel(x,y,qRgb(red, green, blue));
                            cvIndex += 3;
                        }
                        cvLineStart += cvimage->widthStep;
                    }
                    break;
                default:
                    //printf("This number of channels is not supported\n");
                    break;
            }
            break;
        default:
            //printf("This type of IplImage is not implemented in QOpenCVWidget\n");
            break;
    }
    ui->label->setPixmap(QPixmap::fromImage(image));
}

void wideoWindow::saveImage(IplImage *cvimage)
{
    cvWriteFrame( writer, cvimage);

}

Wszytko niby ok film się nagrywa ale zbyt szybko.
Prawdopodobnie winą tego jest że ja nagrywam z fps 25 a kamera daje mniej.
Próbowałem odczytać z kamery jakie daje fps

int fps = (int)cvGetCaptureProperty(camera,CV_CAP_PROP_FPS); 

ale otrzymuję 0.
Czy ktoś z was wie jak poprawnie nagrać obraz z kamery ??