I have this line in my code:
writer = cv.CreateVideoWriter('video.avi', cv.CV_FOURCC('X','V','I','D'), 30 ,(480,800), 1)
Which outputs to console this:
Output #0, avi, to 'video.avi':
Stream #0:0: Video: mpeg4, yuv420p, 480x800, q=2-31, 24576 kb/s, 90k tbn, 30 tbc
I want to stop it from printing anything to stdout, but keep the possibility to output by myself something further in the code. How can I achieve this?
I tried this, but it didn't worked.
class NullStream:
def write(self, text):
pass
sys.stdout = NullStream()
sys.stderr = NullStream()
print "hello" #This doesn't outputs
#This function still outputs to console:
writer = cv.CreateVideoWriter('video.avi', cv.CV_FOURCC('X','V','I','D'), 30 ,(480,800), 1)
sys.stdout = sys.__stdout__
sys.stderr = sys.__stderr__