Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QT video write from images (cv::Mat) problem



  • Hi,

    I am using thread and signal slot mechanism in my opencv object detection framework.

    I decide to write frames as video (mp4 or mjpg) to a file.

    I opened :

    video = new VideoWriter;
    cv::VideoWriter video ("/data/outcpp.avi",CV_FOURCC('M','J','P','G'),25, Size(1280,720));
    ..
    ..
        video->write(frame);
    

    frame is coming from:

    connect(worker , &Worker::frameChanged , recorder , &Vrecorder::recording);
    

    it is creating file outcpp.avi and the size stuct at 4kb. It is not writing the video.

    Same code is working as pure c++ without QT signal slot mechanism.

    Any suggestion ?

    Or any experince to write video from signalling with opencv or ffmpeg ?

    Which one is preferable ?


  • Lifetime Qt Champion

    Hi,

    You should show the complete code you are using. In what you posted, you seem to have some pointer to a VideoWriter, then a local cv::VideoWriter with the same name, then writing through the first object.


Log in to reply