opencv 中压缩视频保存视频 writer=cvCreateVideoWriter("out4.avi",fourcc, fps,  cvSize( DispImage->width,  DispImage->height), 1 );
用cvCreateVideoWriter 函数 中的参数 fourcc 和fps 分别选择什么样的数值。可以保证录像时间五分钟,最后的保存时间也是5分钟?  谢谢了 加: 当fourcc 选1,-1,2 都可以生成avi 文件,  当fourcc 选CV_FOURCC('P','I','M','1'),没法生成avi   为何? 谢谢啦

解决方案 »

  1.   

    fourcc 选-1 ,及 fps =30 的时候,感觉最后生成的视频avi播放时间,比原来录制的少了好久。怎么办?
      

  2.   

    public:
    static IntPtr cvCreateVideoWriter(
    String^ filename, 
    int fourcc, 
    double fps, 
    Size frameSize, 
    bool isColor
    )Parameters
    filename
    String
    Name of the output video file.
    fourcc
    Int32
    4-character code of codec used to compress the frames. For example, CV_FOURCC('P','I','M','1') is MPEG-1 codec, CV_FOURCC('M','J','P','G') is motion-jpeg codec etc.
    fps
    Double
    Framerate of the created video stream. 
    frameSize
    Size
    Size of video frames.
    isColor
    Boolean
    If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames 
    Return Value
    The video writer先看看接口说明