Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 467fa90

Browse files
committed
Add print-out of ffmpeg output when debugging.
1 parent 66b14f1 commit 467fa90

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

lib/matplotlib/animation.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# * Movies
1818
# * Can blit be enabled for movies?
1919
# * Need to consider event sources to allow clicking through multiple figures
20+
import sys
2021
import itertools
2122
import contextlib
2223
import subprocess
@@ -175,10 +176,14 @@ def _run(self):
175176
# movie file. *args* returns the sequence of command line arguments
176177
# from a few configuration options.
177178
command = self._args()
179+
if verbose.ge('debug'):
180+
output = sys.stdout
181+
else:
182+
output = subprocess.PIPE
178183
verbose.report('MovieWriter.run: running command: %s'%' '.join(command))
179184
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)
182187

183188
def finish(self):
184189
'Finish any processing for writing the movie.'
@@ -357,11 +362,14 @@ class FFMpegWriter(MovieWriter, FFMpegBase):
357362
def _args(self):
358363
# Returns the command line parameters for subprocess to use
359364
# ffmpeg to create a movie using a pipe.
360-
# Logging is quieted because subprocess.PIPE has limited buffer size.
361-
return [self.bin_path(), '-f', 'rawvideo', '-vcodec', 'rawvideo',
365+
args = [self.bin_path(), '-f', 'rawvideo', '-vcodec', 'rawvideo',
362366
'-s', '%dx%d' % self.frame_size, '-pix_fmt', self.frame_format,
363-
'-r', str(self.fps), '-loglevel', 'quiet',
364-
'-i', 'pipe:'] + self.output_args
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
365373

366374

367375
#Combine FFMpeg options with temp file-based writing

0 commit comments

Comments
 (0)