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/aarniala.fi-hero-1080p.mov \
-c:v libx264 \
-preset veryslow \
-crf 23 \
-tune film \
public/videos/aarniala.fi-hero-1080p-web.mov
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 👏