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

Skip to content

Commit 87f5b45

Browse files
committed
Merge pull request #5345 from dopplershift/h264-1.5.x
Improve compatibility for h264 ffmpeg-encoded videos. (Backport #5340)
2 parents 3c5d20d + 50b5db8 commit 87f5b45

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/matplotlib/animation.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,12 @@ def output_args(self):
405405
# The %dk adds 'k' as a suffix so that ffmpeg treats our bitrate as in
406406
# kbps
407407
args = ['-vcodec', self.codec]
408+
# For h264, the default format is yuv444p, which is not compatible
409+
# with quicktime (and others). Specifying yuv420p fixes playback on
410+
# iOS,as well as HTML5 video in firefox and safari (on both Win and
411+
# OSX). Also fixes internet explorer. This is as of 2015/10/29.
412+
if self.codec == 'h264' and '-pix_fmt' not in self.extra_args:
413+
args.extend(['-pix_fmt', 'yuv420p'])
408414
if self.bitrate > 0:
409415
args.extend(['-b', '%dk' % self.bitrate])
410416
if self.extra_args:

0 commit comments

Comments
 (0)