rex686568

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
VideoWriter put("output.mpg", CV_FOURCC('M','P','E','G'), 30, S);
        if(!put.isOpened())
        {
                cout << "File could not be created for writing. Check permissions" << endl;
                return -1;
        }

这里 的 S 是size ,视频尺寸, 用 frame.size()即可. 

30 是FPS, 一般都用30帧了, 当然也有60的


下面的代码应该在一个while里面 ,  条件自己添加把~

这里的意思是只要不是空帧,  就把它写入.

存好的视频就在工程文件夹的debug里面


                // Check if the video is over
                if(frame.empty())
                {
                        cout << "Video over" << endl;
                        break;
                }

                put << frame;


posted on 2015-03-18 22:35  rex686568  阅读(507)  评论(0编辑  收藏  举报