cbc9a7a686
The program now works as a video cat or converter : ./prpa -c MP42 -o /tmp/bar.avi /tmp/foo.flv -c specify a 4-letter codec to be used for the output file and follow a strict code defined on this page : http://www.fourcc.org/codecs.php The file output extension *does* matter and must match the selected output codec.
21 lines
484 B
C++
21 lines
484 B
C++
#include "video_writer.hh"
|
|
|
|
bool VideoWriter::open(std::string filename, std::string enc,
|
|
int fps, int width, int height)
|
|
{
|
|
if (enc.length() != 4)
|
|
return false;
|
|
|
|
return this->writer_.open(filename,
|
|
CV_FOURCC(enc[0], enc[1], enc[2], enc[3]), fps, { width, height } );
|
|
}
|
|
|
|
void VideoWriter::write()
|
|
{
|
|
if (this->writer_.isOpened())
|
|
{
|
|
for (auto it = this->images_.begin(); it != this->images_.end(); ++it)
|
|
this->writer_.write(**it);
|
|
}
|
|
}
|