<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 22, 2016 at 7:55 AM,  <span dir="ltr"><<a href="mailto:gml@garymlewis.com" target="_blank">gml@garymlewis.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Thanks Ryan. Very cool nbviewer link you sent me. I use a Jupyter notebook for pretty much all my python development. Very happy with it. ... Anyway, to answer your question. Yes, the movie at the bottom of the notebook works fine for me. Does that imply my issue is not the browser? I see you set matplotlib.rcParams['animation.html'] = 'html5'. My default was set to 'none'. Changing it to 'html5' did not seem to change anything, however. When I open the animation mp4 in Firefox, it immediately says the file is corrupt.<br></blockquote><div><br></div><div>The default is set to none so that nothing breaks by default--as you've seen, making movies can be a bit touchy. :)</div><div><br></div><div>Changing the 'animation.html' setting only changes if (and how) animations are converted to html for the jupyter notebook; it has no impact on how things are saved to mp4. The fact that the movies in the link work, though, mean that it is indeed possible to make matplotlib's animation support write mp4 files that work on those platforms. I note the following from our code that makes html5 videos:</div><div><br></div><div><div>        # For h264, the default format is yuv444p, which is not compatible</div><div>        # with quicktime (and others). Specifying yuv420p fixes playback on</div><div>        # iOS,as well as HTML5 video in firefox and safari (on both Win and</div><div>        # OSX). Also fixes internet explorer. This is as of 2015/10/29.</div><div>        if self.codec == 'h264' and '-pix_fmt' not in self.extra_args:</div><div>            args.extend(['-pix_fmt', 'yuv420p'])</div></div><div><br></div><div>So I'd try passing these to save:</div><div><br></div><div>anim.save('file.mp4', extra_args=['-pix_fmt', 'yuv420p'])</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
I do have one additional item to add that I discovered almost by accident today. I recreated the animation (using a jupyter notebook, as always), but this time I had the linux terminal open where I had started the jupyter notebook. Nothing unusual until the animation completed and I used Firefox to open the mp4 file. Once I did this, I got the following error at the terminal:<br>
[h264 ........] decode-slice-header-error and 'no frame!'<br>
<br>
I am a video novice, but a little search on the error indicated that a keyframe might be missing. Again, this points to user error rather than browser error.<br></blockquote><div><br></div><div>It could be related--I honestly have no clue. I google around finding various solutions, trying stuff until it works. The pix_fmt stuff was enough to get it to work for me.</div><div><br></div><div>Give it a spin and let me know!</div><div><br></div><div>Ryan </div></div>
</div></div>