[IPython-dev] display protocol: animation and video

Brian Granger ellisonbg at gmail.com
Fri Dec 16 23:18:12 EST 2011


On Fri, Dec 16, 2011 at 5:46 PM, Chris Kees <cekees at gmail.com> wrote:
> I'd like to include animations in the notebook and am trying to think
> through the options for connecting to the display protocol.  The case I'm
> targeting is one with a small number of high-resolution frames (e.g. 50 to
> 500 frames). Each frame is generated by compositing portions of the frame
> rendered on (possibly many) mpi engines.  At the moment I generate a png or
> svg of the composite image on the root engine and just bring the last image
> in the sequence over to the client, which I can display with something like

So we have not thought about animiation in the display protocol yet.
Definitely room for improvement.

> c = Client()
> view = c[:]
> view.activate()
> Image(view['imageSequence'][rootEngine][-1])
>
> All I want to do now is make the whole sequence of images available with
> "VCR buttons" (rewind, pause, play, fast forward, maybe a slider to look at
> specific frames).  Should I 1) generate a single SVG of the entire animation
> on the root engine, 2) use ffmpeg via matplotlib or some other wrapper to
> ffmpeg to generate a video on the root engine, or 3) continue bringing over
> the entire image sequence and do the  conversion to animated SVG or mpeg on
> the client.
>
> On 1: I've tried including the SVG for the animation here
> http://srufaculty.sru.edu/david.dailey/svg/ovaling.svg using
> SVG(data="""..."""), but it doesn't show up in the notebook.    Maybe SVG
> animations aren't fully supported in the notebook yet?

What is the MIME type for animated SVGs?  Our current implementation
assumes the standard SVG image MIME type when we construct the data
URI in the browser.

> On 2: How do I bring the mpeg over? Just read the mpeg file on the root
> engine, write it back out on the client, and display using
> HTML(file="filename.mp4")?

I think you will need to encode the image and put it into the HTML
using a data URI:

http://en.wikipedia.org/wiki/Data_URI_scheme

Using this approach you should be able to embed any media type.

Cheers,

Brian

> Thanks for any suggestions.
>
> Chris
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>



-- 
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu and ellisonbg at gmail.com



More information about the IPython-dev mailing list