lelandbatey / gif-machine

Automatic .gif creation from Youtube videos!
55 stars 6 forks source link

Generate GIFs client-side #3

Open Fauntleroy opened 11 years ago

Fauntleroy commented 11 years ago

It should be possible to generate these GIFs client side, basically eliminating any server-side component to this (and lots of cost). In theory, it would work like so:

youtube url -> loads appropriate video file into <video> -> video is duplicated on <canvas> -> use GIF.js to create GIF (in a webworker)

Of course, these GIFs are pretty well compressed... I'm not sure if that's got anything to do with the components used on the server, but if similar results can be achieved this way I think it would be ideal.

lelandbatey commented 11 years ago

The only issue that there might be with this is the consistent grabbing of the raw youtube video. Since I last checked, it wasn't possible to get that video using in-browser javascript (which is why sites like keepvid use a Java applet to get the appropriate video links).

However, you're probably correct that this is totally doable via the browser. Which would be awesome, and useful to a lot of people.

Sadly, I don't think I'll have the chance to investigate it for quite some time. I'd encourage you to see if you can do it yourself.

For right now, the cost to me to host this is low, and I'm being pulled away by other things. But I hope you, or someone else, can make this a reality.

lelandbatey commented 11 years ago

Also, the image compression is entirely handled by the Imagemagick library on the server side. Because of that, you may be able to adapt the Imagemagick process to extend Gif.js