fadelakin / slide

do you slide on all your nights like this?
20 stars 0 forks source link

Use mp4 over gif #2

Open zethussuen opened 7 years ago

zethussuen commented 7 years ago

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

fadelakin commented 7 years ago

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. 👍

zethussuen commented 7 years ago

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 :)

fadelakin commented 6 years ago

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