Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve compatibility for h264 ffmpeg-encoded videos. #5340

Merged
merged 1 commit into from Oct 29, 2015

Conversation

dopplershift
Copy link
Contributor

Default pixel format of yuv444 is, apparently, not widely supported.
Changing to yuv420p fixes playback with Quicktime, on iOS, and with a
wide array of browsers (for HTML5 video).

@dopplershift dopplershift added this to the next point release (1.5.0) milestone Oct 28, 2015
@mdboom
Copy link
Member

mdboom commented Oct 28, 2015

We probably should also test Chrome and Linux (in combinations with what you already tested). Can you link to a file produced by this and/or a script to easily recreate one?

@dopplershift
Copy link
Contributor Author

To be clear, Chrome was already working (at least on OSX and Win); it just turned out that none of the others worked. Here's an HTML page with a video embedded, as well as the same animation as an m4v.

test.m4v | uploaded via ZenHub

test.html | uploaded via ZenHub

I just modded simple_anim.py example, but if you think it's worth having, I can commit a version for this kind of easy testing.

# as well as HTML5 video in firefox and safari (on both Win and OSX).
# Also fixes internet explorer. This is as of 2015/10/29.
if self.codec == 'h264':
args.extend(['-pix_fmt', 'yuv420p'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably check that this isn't already in self.extra_args?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

@@ -405,6 +405,12 @@ def output_args(self):
# The %dk adds 'k' as a suffix so that ffmpeg treats our bitrate as in
# kbps
args = ['-vcodec', self.codec]
# For h264, the default format is yuv444, which is not compatible with
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, super picky, the default format is 'yuv444p'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easy enough to update.

Default pixel format of yuv444p is, apparently, not widely supported.
Changing to yuv420p fixes playback with Quicktime, on iOS, and with a
wide array of browsers (for HTML5 video).
tacaswell added a commit that referenced this pull request Oct 29, 2015
MNT: Improve compatibility for h264 ffmpeg-encoded videos.
@tacaswell tacaswell merged commit 05015cc into matplotlib:master Oct 29, 2015
@tacaswell
Copy link
Member

I am 50/50 on back-porting this for 1.5.

@dopplershift
Copy link
Contributor Author

It's low risk, and I'd consider the fact that the HTML5 videos generated in 1.5 currently only work on Chrome a bug.

@dopplershift dopplershift deleted the h264-compat branch October 29, 2015 03:27
mdboom added a commit that referenced this pull request Oct 29, 2015
Improve compatibility for h264 ffmpeg-encoded videos. (Backport #5340)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants