Skip to content

Commit 3bdea02

Browse files
author
Nathan Goldbaum
committed
don't attempt to use libav ffmpeg shim on ubuntu 12.04
1 parent b87772d commit 3bdea02

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ addons:
1313
packages:
1414
- inkscape
1515
- libav-tools
16-
- libavcodec-extra-53
1716
- gdb
1817
- mencoder
1918
- dvipng

lib/matplotlib/animation.py

+23-8
Original file line numberDiff line numberDiff line change
@@ -400,16 +400,23 @@ 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()
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
409411
return True
410412
except OSError:
411413
return False
412414

415+
@classmethod
416+
def _handle_subprocess(cls, process):
417+
process.communicate()
418+
return True
419+
413420

414421
class FileMovieWriter(MovieWriter):
415422
'''`MovieWriter` for writing to individual files and stitching at the end.
@@ -584,10 +591,18 @@ def output_args(self):
584591

585592
return args + ['-y', self.outfile]
586593

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+
587602

588603
# Combine FFMpeg options with pipe-based writing
589604
@writers.register('ffmpeg')
590-
class FFMpegWriter(MovieWriter, FFMpegBase):
605+
class FFMpegWriter(FFMpegBase, MovieWriter):
591606
'''Pipe-based ffmpeg writer.
592607
593608
Frames are streamed directly to ffmpeg via a pipe and written in a single
@@ -608,7 +623,7 @@ def _args(self):
608623

609624
# Combine FFMpeg options with temp file-based writing
610625
@writers.register('ffmpeg_file')
611-
class FFMpegFileWriter(FileMovieWriter, FFMpegBase):
626+
class FFMpegFileWriter(FFMpegBase, FileMovieWriter):
612627
'''File-based ffmpeg writer.
613628
614629
Frames are written to temporary files on disk and then stitched

0 commit comments

Comments
 (0)