|
17 | 17 | # * Movies |
18 | 18 | # * Can blit be enabled for movies? |
19 | 19 | # * Need to consider event sources to allow clicking through multiple figures |
| 20 | +import sys |
20 | 21 | import itertools |
21 | 22 | import contextlib |
22 | 23 | import subprocess |
@@ -175,10 +176,14 @@ def _run(self): |
175 | 176 | # movie file. *args* returns the sequence of command line arguments |
176 | 177 | # from a few configuration options. |
177 | 178 | command = self._args() |
| 179 | + if verbose.ge('debug'): |
| 180 | + output = sys.stdout |
| 181 | + else: |
| 182 | + output = subprocess.PIPE |
178 | 183 | verbose.report('MovieWriter.run: running command: %s'%' '.join(command)) |
179 | 184 | self._proc = subprocess.Popen(command, shell=False, |
180 | | - stdout=subprocess.PIPE, stderr=subprocess.PIPE, |
181 | | - stdin=subprocess.PIPE) |
| 185 | + stdout=output, stderr=output, |
| 186 | + stdin=subprocess.PIPE) |
182 | 187 |
|
183 | 188 | def finish(self): |
184 | 189 | 'Finish any processing for writing the movie.' |
@@ -356,10 +361,15 @@ def output_args(self): |
356 | 361 | class FFMpegWriter(MovieWriter, FFMpegBase): |
357 | 362 | def _args(self): |
358 | 363 | # Returns the command line parameters for subprocess to use |
359 | | - # ffmpeg to create a movie using a pipe |
360 | | - return [self.bin_path(), '-f', 'rawvideo', '-vcodec', 'rawvideo', |
361 | | - '-s', '%dx%d' % self.frame_size, '-pix_fmt', self.frame_format, |
362 | | - '-r', str(self.fps), '-i', 'pipe:'] + self.output_args |
| 364 | + # ffmpeg to create a movie using a pipe. |
| 365 | + args = [self.bin_path(), '-f', 'rawvideo', '-vcodec', 'rawvideo', |
| 366 | + '-s', '%dx%d' % self.frame_size, '-pix_fmt', self.frame_format, |
| 367 | + '-r', str(self.fps)] |
| 368 | + # Logging is quieted because subprocess.PIPE has limited buffer size. |
| 369 | + if not verbose.ge('debug'): |
| 370 | + args += ['-loglevel', 'quiet'] |
| 371 | + args += ['-i', 'pipe:'] + self.output_args |
| 372 | + return args |
363 | 373 |
|
364 | 374 |
|
365 | 375 | #Combine FFMpeg options with temp file-based writing |
|
0 commit comments