@@ -400,16 +400,21 @@ def isAvailable(cls):
400
400
if not bin_path :
401
401
return False
402
402
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 )
410
410
except OSError :
411
411
return False
412
412
413
+ @classmethod
414
+ def _handle_subprocess (cls , process ):
415
+ process .communicate ()
416
+ return True
417
+
413
418
414
419
class FileMovieWriter (MovieWriter ):
415
420
'''`MovieWriter` for writing to individual files and stitching at the end.
@@ -584,10 +589,18 @@ def output_args(self):
584
589
585
590
return args + ['-y' , self .outfile ]
586
591
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
+
587
600
588
601
# Combine FFMpeg options with pipe-based writing
589
602
@writers .register ('ffmpeg' )
590
- class FFMpegWriter (MovieWriter , FFMpegBase ):
603
+ class FFMpegWriter (FFMpegBase , MovieWriter ):
591
604
'''Pipe-based ffmpeg writer.
592
605
593
606
Frames are streamed directly to ffmpeg via a pipe and written in a single
@@ -608,7 +621,7 @@ def _args(self):
608
621
609
622
# Combine FFMpeg options with temp file-based writing
610
623
@writers .register ('ffmpeg_file' )
611
- class FFMpegFileWriter (FileMovieWriter , FFMpegBase ):
624
+ class FFMpegFileWriter (FFMpegBase , FileMovieWriter ):
612
625
'''File-based ffmpeg writer.
613
626
614
627
Frames are written to temporary files on disk and then stitched
0 commit comments