当我用OpenCV的VideoWriter
类创建视频时,它会在终端中输出这样的内容:
Output #0, avi, to 'video.avi':
Stream #0.0: Video: mpeg4, yuv420p, 512x384, q=2-31, 12582 kb/s, 90k tbn, 24 tbc
我想禁用它,但我不知道如何做到这一点。
"静音"控制台一段时间。参考
#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<<"An";
std::cout.rdbuf(fout.rdbuf()); // redirect 'cout' to a 'fout'
std::cout<<"Bn";
std::cout.rdbuf(cout_sbuf); // restore the original stream buffer
std::cout<<"Cn";
return 0;
}
控制台输出:
A
C