The discussion revolves around converting GIFs to MP4 video files in Discourse. erlend_sh suggests mimicking Twitter’s approach, while codinghorror mentions gfycat.com, which automatically converts GIFs to WebM. lidel proposes using gfycat’s API or replicating the functionality with ffmpeg.
Imgur is also discussed, with lidel mentioning their introduction of GIFV, which automatically converts uploaded GIFs to MP4. sam suggests using a similar approach, with a video element and fallbacks, and proposes actionable steps, including forcing a click to download large GIFs, converting animated GIFs to WebM and MP4, and integrating with Imgur.
lidel suggests replacing GIFs with looped videos from common providers, while lightyear suggests using the onebox to add a whitelist for these providers. codinghorror is fine with special MP4 handling for these services.
The discussion also touches on the issue of large GIFs causing problems on mobile devices and the benefits of converting GIFs to MP4, including better compression and fullscreen functionality. Tris20 asks if the solution was implemented, and codinghorror responds that clicking a GIF to go fullscreen doesn’t make sense. Tris20 explains the need for fullscreen functionality, and codinghorror suggests adding a notice to inform users how to make GIFs full size.
Yep, it seems to have built up a fair bit of traction, mostly thanks to the Reddit crowd. There’s an API of sorts too. If Discourse did its automatic grab-the-file-and-self-host-it I suppose this might work in the short term.
I really think this kind of workaround ought to be open source though. A lot of articles I’ve read describe Gfy as a new format, which is very misleading. There’s only one way to make a “Gfy”, and that’s through Gfycat.com. Gfy is a service.
Some communities would benefit from such functionality.
Especially ones with download remote images to local setting enabled , 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?
The cornerstone of Project GIFV is a platform-wide upgrade to automatically convert uploaded GIF files on the fly into the MP4 video format. [..]
The .GIFV Extension: With all these improvements, Imgur will now denote converted MP4s with a “.gifv” extension. The intention is to signal to users throughout the Internet that these links will feature a GIF experience that incorporates all the current and future enhancements made through Project GIFV. Imgur plans to submit an accompanying specification to relevant standards organizations before the end of the year.
Exactly!
Discourse already has onebox for MP4 files.
So the only missing piece is some kind of a sidekick job that does the conversion and slight modification to the onebox to loop by default (if mp4 was created from gif).
It works for imgur.
For example something like https://i.imgur.com/mYNXTPw.gif can be requested as https://i.imgur.com/mYNXTPw.webm which gives:
It would be nice if Discourse detected .gif URLs from common providers such as imgur/gfycat
and just replaced image with looped video (already provided by site), as it saves a lot of bandwidth.
That sounds like something that could easily be done using the onebox, adding a white list either in the image or video engine. I am happy to build that, if such a PR is wanted (could also be behind a configuration setting, if needed).
Chrome does a terrible job with huge gif files, they can choke the web browser and cause all sorts of nasties not to mention mobile paying a hefty price on traffic and blowing data plans.
It’s really just a video element with a bunch of fallbacks.
I see a few actionable things we can do here:
If people hotlink anything larger than say 10mb force a “click” to actually download the image and hide it behind a preview
get ffmpeg into our base image and do the webm and mp4 conversion for all animated gifs, don’t worry about the flash fallback.
Offer an integration piece with imgur that uses imgur to do this … any gif larger than X gets sent to imgur for recompression. (or use a different service)
One thing to consider is how Slack deals with this:
http://img0.joyreactor.cc/pics/post/%D0%B3%D0%B8%D1%84%D0%BA%D0%B8-superjail-%D0%BC%D1%83%D0%BB%D1%8C%D1%82%D1%81%D0%B5%D1%80%D0%B8%D0%B0%D0%BB-%D0%A1%D0%B2%D0%BE%D1%8F-%D0%B0%D1%82%D0%BC%D0%BE%D1%81%D1%84%D0%B5%D1%80%D0%B0-1886210.gif (Not automatically expanded because 30MB is too large. You can expand it anyway or open it in a new window. You can also change your preferences to allow images of any file size to auto expand.)
이렇게 묻는 이유는, 제가 잘못 알고 있는 것이 아니라면 라이트박싱(lightboxing)이 GIF와 호환되지 않는 것 같기 때문입니다. 즉, GIF를 클릭하여 전체 화면으로 전환할 수 없습니다. GIF에 상세한 텍스트가 포함된 경우, 사용자는 새 탭에서 이미지를 열지 않고는 확대할 수 없습니다.
그러나 업로드 시 GIF가 MP4로 변환된다면, 기존 비디오 플레이어의 전체 화면 기능과 시간 바를 활용할 수 있어 큰 이점이 있습니다. 짧은 튜토리얼 클립을 볼 때 특히 그렇습니다!
다양한 문서 스타일(텍스트만, 영상만, 텍스트 + GIF)을 비교해 본 결과, 텍스트 + GIF 옵션이 압도적으로 우수했습니다. 따라서 튜토리얼 게시물에서 GIF를 사용하여 내용을 시연할 계획입니다. 하지만 GIF를 전체 화면으로 표시하거나 라이트박스(lightbox)로 열 수 없다면, 작성된 텍스트가 잘 보이지 않는 경우가 많습니다.
하지만 우리가 정말 필요한 것은 GIF를 전체 크기로 만들 수 있는 기능입니다. 우클릭하여 새 탭에서 여는 방식은 숙련된 사용자에게는 괜찮지만, 나머지 90%의 사용자에게는 그렇게 적응하라고 기대할 수 없습니다. 따라서 업로드된 GIF가 클릭 시 전체 화면으로 확대되는 라이트박스 기능을 지원하거나, 단순히 MP4로 변환하여 Discourse의 전체 화면 기능을 활용할 수 있도록 해야 합니다.