slide icon indicating copy to clipboard operation
slide copied to clipboard

Use mp4 over gif

Open zethussuen opened this issue 8 years ago • 3 comments

imageio api supports the usage of ffmpeg to write to mp4 which would be less intensive to generate plus a smaller filesize than gif

ImageIO API for mimwrite() http://imageio.readthedocs.io/en/latest/userapi.html#imageio.mimwrite

zethussuen avatar Sep 26 '17 19:09 zethussuen

hmmm. i've never used ffmpeg to write to mp4 before so i'll also look into this, this coming weekend as well. i like the idea of mp4 over gif because then, there is no need to generate multiple images but i would have to make sure it doesn't break the architecture that is currently present and wouldn't make me have to do a slightly major rewrite of things. but we'll see. 👍

fadelakin avatar Sep 26 '17 21:09 fadelakin

I don't think you'll need direct interfacing with ffmpeg. From the link it seems you can use the following syntax:

imageio.mimwrite(uri, ims, format='.mp4')

if you look at line 221 on track.py, it's: imageio.mimsave(str(tag) + '.gif', images)

I think you can just pass a local filename for uri, the format (str) as mp4, as well as the images array as ims. I haven't pulled the code locally to test, but if I get some freetime this week I'll take a stab :)

zethussuen avatar Sep 27 '17 02:09 zethussuen

Oh interesting. I keep thinking these things will be too complicated but Python makes things easier than other languages

fadelakin avatar Sep 27 '17 18:09 fadelakin