-
Notifications
You must be signed in to change notification settings - Fork 8
/
OutputVideo.cpp
47 lines (35 loc) · 1.04 KB
/
OutputVideo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* File: OutputVideo.cpp
* Author: Jan Dufek
*/
#include "OutputVideo.hpp"
#include <iostream>
using namespace std;
OutputVideo::OutputVideo(double f, Size s, string n) {
fps = f;
size = s;
name = n;
}
OutputVideo::OutputVideo(const OutputVideo& orig) {
}
OutputVideo::~OutputVideo() {
}
/**
* Initialize video writer.
*
* @return
*/
VideoWriter OutputVideo::get_video_writer() {
// Codec used to output the video
// This is higher size: int outputVideoCodec = CV_FOURCC('W','R','L','E');
// This works navite on Mac: int outputVideoCodec = CV_FOURCC('m', 'p', '4', 'v');
// This works with ffmpeg:
int output_video_codec = CV_FOURCC('D', 'I', 'V', 'X');
// Open output video file
VideoWriter output_video(name + ".avi", output_video_codec, fps, size, true);
// Check if output video file was successfully opened
if (!output_video.isOpened()) {
cout << "Cannot open the output video file " << name + ".avi" << " for write." << endl;
}
return output_video;
}