From 85bbbbb589a4c6b1902ad736ab884ca0d2bed326 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 16 Jan 2024 11:38:48 +0000 Subject: [PATCH] index: Add VP9 encoded version for ancient browsers Signed-off-by: Michael Tremer --- Makefile.am | 32 +++++++++++++++++++++++++++++--- src/templates/index.html | 5 ++++- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 30dc63a1..538918bb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1038,7 +1038,8 @@ static_videos_DATA = \ src/static/videos/firewall.jpg \ src/static/videos/firewall@1920.av1.mp4 \ src/static/videos/firewall@1920.h265.mp4 \ - src/static/videos/firewall@1920.h264.mp4 + src/static/videos/firewall@1920.h264.mp4 \ + src/static/videos/firewall@1920.vp9.mp4 static_videosdir = $(staticdir)/videos @@ -1161,8 +1162,15 @@ src/static/img/apple-touch-icon-%-precomposed.png: src/static/img/ipfire-tux.png # Video Stuff -FFMPEG += \ - -loglevel quiet +# Multi-threading options for faster encoding +FFMPEG_MT = \ + -row-mt 1 \ + -threads $(shell getconf _NPROCESSORS_ONLN) \ + -tile-columns 2 + +# Enable to log less +#FFMPEG += \ +# -loglevel quiet # AV1 src/static/videos/firewall@%.av1.mp4: src/static/videos/firewall.mp4 @@ -1211,6 +1219,24 @@ src/static/videos/firewall@%.h264.mp4: src/static/videos/firewall.mp4 -vf scale=$(patsubst src/static/videos/firewall@%.h264.mp4,%,$@):-2,fps=25 \ $@ +# VP9 +src/static/videos/firewall@%.vp9.mp4: src/static/videos/firewall.mp4 + $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \ + $(FFMPEG) -y \ + -i $^ \ + -map_metadata -1 \ + -an \ + -c:v libvpx-vp9 \ + -b:v 0 \ + -crf 31 \ + -deadline best \ + -preset veryslow \ + -pix_fmt yuv420p \ + -movflags +faststart \ + -vf scale=$(patsubst src/static/videos/firewall@%.vp9.mp4,%,$@):-2:flags=lanczos,fps=25 \ + $(FFMPEG_MT) \ + $@ + # Cover image src/static/videos/firewall.jpg: src/static/videos/firewall.mp4 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \ diff --git a/src/templates/index.html b/src/templates/index.html index faec6052..ad5f982a 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -60,9 +60,12 @@ {# H.265/HEVC for modern browsers #} - {# H.264/AVC as compatibility option for anything else #} + {# H.264/AVC for people who have a hardware decoder for it #} + {# VP9 as compatibility option for anything else #} + +

Blazing Fire by Oleg Gamulinskii (CC) https://www.pexels.com/video/blazing-fire-2715412/ -- 2.47.2