Disable OpenWV VideoWriter output

When I create a video with the OpenCV class VideoWriter, it outputs something like this in the terminal:

Output #0, avi, to 'video.avi':
Stream #0.0: Video: mpeg4, yuv420p, 512x384, q=2-31, 12582 kb/s, 90k tbn, 24 tbc

I would like to disable this, but I have no idea how to do this.

+4
source share
1 answer

Turn off the console for a while. Link .

#include <iostream>
#include <fstream>
int main ( int argc, char** argv )
{
    std::streambuf* cout_sbuf = std::cout.rdbuf(); // save original sbuf
    std::ofstream   fout("temp");
    std::cout<<"A\n";
    std::cout.rdbuf(fout.rdbuf()); // redirect 'cout' to a 'fout'
    std::cout<<"B\n";
    std::cout.rdbuf(cout_sbuf); // restore the original stream buffer
    std::cout<<"C\n";
    return 0;
}

Console output:

A
C
0
source

Source: https://habr.com/ru/post/1537487/


All Articles