@@ -400,16 +400,23 @@ 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 ()
403
+ p = subprocess .Popen (
404
+ bin_path ,
405
+ shell = False ,
406
+ stdout = subprocess .PIPE ,
407
+ stderr = subprocess .PIPE ,
408
+ creationflags = subprocess_creation_flags )
409
+ if not cls ._handle_subprocess (p ):
410
+ return False
409
411
return True
410
412
except OSError :
411
413
return False
412
414
415
+ @classmethod
416
+ def _handle_subprocess (cls , process ):
417
+ process .communicate ()
418
+ return True
419
+
413
420
414
421
class FileMovieWriter (MovieWriter ):
415
422
'''`MovieWriter` for writing to individual files and stitching at the end.
@@ -584,10 +591,18 @@ def output_args(self):
584
591
585
592
return args + ['-y' , self .outfile ]
586
593
594
+ @classmethod
595
+ def _handle_subprocess (cls , process ):
596
+ _ , err = process .communicate ()
597
+ # Ubuntu 12.04 ships a broken ffmpeg binary which we shouldn't use
598
+ if 'Libav' in err .decode ():
599
+ return False
600
+ return True
601
+
587
602
588
603
# Combine FFMpeg options with pipe-based writing
589
604
@writers .register ('ffmpeg' )
590
- class FFMpegWriter (MovieWriter , FFMpegBase ):
605
+ class FFMpegWriter (FFMpegBase , MovieWriter ):
591
606
'''Pipe-based ffmpeg writer.
592
607
593
608
Frames are streamed directly to ffmpeg via a pipe and written in a single
@@ -608,7 +623,7 @@ def _args(self):
608
623
609
624
# Combine FFMpeg options with temp file-based writing
610
625
@writers .register ('ffmpeg_file' )
611
- class FFMpegFileWriter (FileMovieWriter , FFMpegBase ):
626
+ class FFMpegFileWriter (FFMpegBase , FileMovieWriter ):
612
627
'''File-based ffmpeg writer.
613
628
614
629
Frames are written to temporary files on disk and then stitched
0 commit comments