Optimize webm videos and webp images #2

Merged
ahmza merged 1 commits from optimize-media into main 2026-07-25 02:22:44 +00:00
Owner

Summary

Re-encode and downscale oversized media assets to shrink the served site (and Docker image) with no visible quality loss.

Changes

Videos (webm) — VP9 re-encode at CRF 38

All meme clips were over-encoded (some at ~4000k bitrate for tiny 480p loops). Re-encoded to VP9 CRF 38, audio stripped (they're muted autoplay loops). Resolutions preserved; every file verified playable.

3.2 MB → 1.37 MB (−56%) — biggest wins: wasnt-so-bad −67%, you-shall-not-pass −59%, mha-power −47%.

Images (webp) — downscale + re-encode

  • background.webp: 3394×1940 → 1920 wide, q80 — 784K → 442K (−43%). Used blurred on the homepage, so no visible change.
  • profile.webp: 1920×1920 → 512×512, q85 — 256K → 76K (−71%). This is an animated webp; the 5-frame animation, 10fps timing, and infinite loop are preserved.
  • Content screenshots: already optimally compressed, left unchanged.

Impact

Size
Served site content ~6.1 MB → 4.0 MB
Docker image 23.1 MB → 18.7 MB (~42% smaller than the original nginx image)

Verification

  • Every re-encoded webm fully decoded without errors; resolutions unchanged.
  • profile.webp confirmed still animated (5 frames, same timing/loop).
  • Full docker build succeeds; measured the 18.7 MB result.
## Summary Re-encode and downscale oversized media assets to shrink the served site (and Docker image) with no visible quality loss. ## Changes ### Videos (webm) — VP9 re-encode at CRF 38 All meme clips were over-encoded (some at ~4000k bitrate for tiny 480p loops). Re-encoded to VP9 CRF 38, audio stripped (they're muted autoplay loops). Resolutions preserved; every file verified playable. **3.2 MB → 1.37 MB (−56%)** — biggest wins: `wasnt-so-bad` −67%, `you-shall-not-pass` −59%, `mha-power` −47%. ### Images (webp) — downscale + re-encode - `background.webp`: 3394×1940 → 1920 wide, q80 — **784K → 442K (−43%)**. Used blurred on the homepage, so no visible change. - `profile.webp`: 1920×1920 → 512×512, q85 — **256K → 76K (−71%)**. This is an **animated webp**; the 5-frame animation, 10fps timing, and infinite loop are preserved. - Content screenshots: already optimally compressed, left unchanged. ## Impact | | Size | |---|---| | Served site content | ~6.1 MB → **4.0 MB** | | Docker image | 23.1 MB → **18.7 MB** (~42% smaller than the original nginx image) | ## Verification - Every re-encoded webm fully decoded without errors; resolutions unchanged. - `profile.webp` confirmed still animated (5 frames, same timing/loop). - Full `docker build` succeeds; measured the 18.7 MB result.
ahmza added 1 commit 2026-07-25 02:21:10 +00:00
Re-encode all webm meme clips as VP9 at CRF 38 (audio stripped; they are
muted autoplay loops). Downscale oversized images: background.webp
3394->1920 wide q80, profile.webp 1920->512 q85 (animation preserved).

Results:
- webm: 3.2MB -> 1.37MB (-56%)
- webp: 1.2MB -> 0.70MB (-42%)
- Docker image: 23.1MB -> 18.7MB (~42% smaller than the original nginx image)

All videos verified valid/playable; profile.webp animation (5 frames)
kept intact.
ahmza merged commit 25b6e0575a into main 2026-07-25 02:22:44 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ahmza/blog-ahmza-com#2