Should Discourse convert GIFs to mp4 video files?

Some communities would benefit from such functionality.
Especially ones with download remote images to local setting enabled :stuck_out_tongue:, but faster page loads alone is a good reason to think about it.

Quick hack would be to just use gfycat.com API.
Assuming one does not mirror remote images, I think it is achievable even with pure Javascript which you can add via /admin/customize/css_html. Lets say JS iterates over posts and if it finds .gif image. HTTP GET is performed:
http://upload.gfycat.com/transcode?fetchUrl=i.imgur.com/jGMtJIb.gif
It downloads&converts remote image (if not already present) and returns JSON with video details. At this point you replace .gif with video in post (see section “How can I embed these or link to them?”)
Custom plugin which bakes .webm into posts via background job would be of course more elegant.

Anyway,
I don’t think they (gfycat) do anything magical beside handling hight traffic quite well.
We can replicate functionality with ffmpeg alone (see 4chan’s guide to converting GIF to WebM).

If we plan to self-host .webm it would be just an extension to already existing download remote images to local feature. We would have an additional setting replace .gifs with optimized .webm versions (we could add another setting: convert only .gifs bigger than…).

Such native functionality requires ffmpeg as a dependency and comes with additional security risks.
It does not sound like a good default for Discourse: maybe it is possible to create it as a plugin?

7 Likes