Cloudflare video squeeze

How to make your video fit into Cloudflare Pages' size limit.

This website is served via Cloudflare Pages, which imposes a maximum size limit of 25MiB for any static assets.

My frontpage features a background hero video which was originally 29MiB, just above the size limit. To make the video smaller, we can turn to the swiss army knife of video processing, ffmpeg:

ffmpeg -i original-video/ \
  -c:v libx264 \
  -preset veryslow \
  -crf 23 \
  -tune film \

The most important parameter here is crf which controls the quality of the resulting video. For my purposes the default value of 23 worked well.

The resulting video (as seen below) clocks in at 4MiB 👏

Shot around Helsinki, Finland with an Fujifilm XT-3 with Sirui 50mm f/1.8 and Samyang 12mm f/2.0 lenses.