]> git.ipfire.org Git - ipfire.org.git/commitdiff
index: Add VP9 encoded version for ancient browsers
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 16 Jan 2024 11:38:48 +0000 (11:38 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 16 Jan 2024 11:38:48 +0000 (11:38 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/templates/index.html

index 30dc63a1d19e328977abfdab500171e7833b6724..538918bbac0e8255fadb7b9b3e6efbc3997e6c6b 100644 (file)
@@ -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 $@) && \
index faec6052c32d41ad79539ce20d7e8798acf7ca9e..ad5f982ad676f2411e0d02a0f2b54825621ee178 100644 (file)
                        {# H.265/HEVC for modern browsers #}
                        <source src="{{ static_url("videos/firewall@1920.h265.mp4") }}" type="video/mp4; codecs=hvc1" />
 
-                       {# H.264/AVC as compatibility option for anything else #}
+                       {# H.264/AVC for people who have a hardware decoder for it #}
                        <source src="{{ static_url("videos/firewall@1920.h264.mp4") }}" type="video/mp4; codecs=avc1.4D401E" />
 
+                       {# VP9 as compatibility option for anything else #}
+                       <source src="{{ static_url("videos/firewall@1920.vp9.mp4") }}" type="video/mp4; codecs=vp9" />
+
                        <p>
                                Blazing Fire by Oleg Gamulinskii (CC)
                                https://www.pexels.com/video/blazing-fire-2715412/