小编Unu*_*ore的帖子

使用opencv c ++每1分钟创建一个新的视频文件

我正在用opencv制作一个小的“ Dashcam”。我想创建一个以当前日期和时间命名的新视频文件的每一分钟都很简单。这些视频文件的内容是网络摄像头的框架。

但是,经过第一分钟后,不再生成视频文件。

这是我的注释代码:

#include <iostream>
#include <windows.h>
#include <ctime>
#include <time.h>
#include <fstream>
#include <opencv2/core/core.hpp>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;


int record_video()
{
    VideoCapture cam(0);
    if (!cam.isOpened())
    {
        cout << "Error from webcam" << endl;
        return -1;
    }

    time_t t = time(0);
    struct tm* now = localtime( & t );
    char buffer[80];

    strftime(buffer, 80, "%F_%Hh%M.wmv", now); //get the date and time for my file

    VideoWriter video(buffer, CV_FOURCC('W', 'M', 'V', '2'), 30, Size(640, 480), true); //Creation of …
Run Code Online (Sandbox Code Playgroud)

c++ video opencv video-processing video-recording

3
推荐指数
1
解决办法
420
查看次数

标签 统计

c++ ×1

opencv ×1

video ×1

video-processing ×1

video-recording ×1