The GIF Inefficiency of Cloudflare
Published: 19th of January 2019
As computers have become more powerful and web browsers have started to gain better support for video codecs (Thanks to Cisco OpenH264), many websites have started to move away from GIF’s and towards loopable silent videos. This is due to the more efficient compression than H.264 or AVC is able to provide, this is because that codec is designed for video streaming, unlike GIFs’ which are just designed for a few frames of animation (GIFs’ were never designed for video clips, but that is what they ended up being used for after the age of broadband).
Why and how is Cloudflare encouraging inefficient uses of GIFs'?
Cloudflare is one is of the biggest CDN providers in the world with w3techs estimating that around 7.6 percent of websites use Cloudflare as a CDN. On top of that, Cloudflare makes a big song and dance about supporting new technologies but by default they will not cache any videos files, which encourages people to waste 80% to 90% more bandwidth as they are just wasting Cloudflares’ bandwidth unlike an efficient user who uses much smaller loopable videos that will need to pay for all the bandwidth themselves, while providing a slower experience for the end user who has wait for the Cloudflare reverse proxy to download and pass the video file every time.
Apparently there ways of using page rules to force Cloudflare to cache MP4 files but as not only does this require the webmaster to set up a new page rule but Cloudflare now have a paid service for this, so there is no reason for them not to break it in order to get a webmaster to one dollar for every thousand minutes of video served from their servers. This leaves webmasters using this service a choice between serving up much larger GIF files or hoping that Cloudflare never restricts page rules for profit.
How could Cloudflare allow MP4-GIFs'?
Telling the difference between a video and a “video-gif” can be done by checking its’ media info for the following;
No audio stream
A video stream that is less than 15 seconds long
On top of that, Cloudflare could add an option box in the page rules specifically to select a location the folder where the video-gif’s are located. Of cause, Cloudflare would need to have a section of their terms of service to kick off users who try to manually combine a load of videos with separate audio into a longer media stream.