@@ -400,16 +400,21 @@ def isAvailable(cls):
400400 if not bin_path :
401401 return False
402402 try :
403- p = subprocess .Popen (bin_path ,
404- shell = False ,
405- stdout = subprocess . PIPE ,
406- stderr = subprocess .PIPE ,
407- creationflags = subprocess_creation_flags )
408- p . communicate ( )
409- return True
403+ p = subprocess .Popen (
404+ bin_path ,
405+ shell = False ,
406+ stdout = subprocess .PIPE ,
407+ stderr = subprocess . PIPE ,
408+ creationflags = subprocess_creation_flags )
409+ return cls . _handle_subprocess ( p )
410410 except OSError :
411411 return False
412412
413+ @classmethod
414+ def _handle_subprocess (cls , process ):
415+ process .communicate ()
416+ return True
417+
413418
414419class FileMovieWriter (MovieWriter ):
415420 '''`MovieWriter` for writing to individual files and stitching at the end.
@@ -584,10 +589,18 @@ def output_args(self):
584589
585590 return args + ['-y' , self .outfile ]
586591
592+ @classmethod
593+ def _handle_subprocess (cls , process ):
594+ _ , err = process .communicate ()
595+ # Ubuntu 12.04 ships a broken ffmpeg binary which we shouldn't use
596+ if 'Libav' in err .decode ():
597+ return False
598+ return True
599+
587600
588601# Combine FFMpeg options with pipe-based writing
589602@writers .register ('ffmpeg' )
590- class FFMpegWriter (MovieWriter , FFMpegBase ):
603+ class FFMpegWriter (FFMpegBase , MovieWriter ):
591604 '''Pipe-based ffmpeg writer.
592605
593606 Frames are streamed directly to ffmpeg via a pipe and written in a single
@@ -608,7 +621,7 @@ def _args(self):
608621
609622# Combine FFMpeg options with temp file-based writing
610623@writers .register ('ffmpeg_file' )
611- class FFMpegFileWriter (FileMovieWriter , FFMpegBase ):
624+ class FFMpegFileWriter (FFMpegBase , FileMovieWriter ):
612625 '''File-based ffmpeg writer.
613626
614627 Frames are written to temporary files on disk and then stitched
0 commit comments