From a1fd978cab04db45f95c18f73f33fc114262cc18 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Fri, 28 Aug 2026 13:48:52 -0500 Subject: [PATCH] switch nginx-vod-module to the maintained dio-az fork (#24123) The `v1.x` line is the same muxed fMP4 code as Kaltura's 1.31 with fixes backported, so the mapping JSON, manifest routes, and ffmpeg consumers are unchanged. The `MAX_CLIPS` patch applies as-is and the HEVC workaround is rewritten for the fork's reformatted source. `vod_hls_version 6` is now explicit because the fork replaced Kaltura's automatic version calculation with a directive that defaults to 4 and only warns when fmp4 needs 6, so playlists were being stamped `EXT-X-VERSION:4` while carrying `EXT-X-MAP`. The `error_page 502 =404` hack is gone: https://github.com/kaltura/nginx-vod-module/issues/468 is a `vod_mode remote` bug and we're `mapped`, so those 502s were really `_vod_response` returning 404 upstream. The fork maps that through now, and the hack was also turning real 5xx into "no recordings". --- docker/main/build_nginx.sh | 16 ++++++++-------- .../main/rootfs/usr/local/nginx/conf/nginx.conf | 12 ++++-------- web/src/components/player/GenericVideoPlayer.tsx | 4 ++-- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/docker/main/build_nginx.sh b/docker/main/build_nginx.sh index 708a4cb45c..4a8ea15d45 100755 --- a/docker/main/build_nginx.sh +++ b/docker/main/build_nginx.sh @@ -3,7 +3,7 @@ set -euxo pipefail NGINX_VERSION="1.27.4" -VOD_MODULE_VERSION="1.31" +VOD_MODULE_VERSION="v1.9.1" SECURE_TOKEN_MODULE_VERSION="1.5" SET_MISC_MODULE_VERSION="v0.33" NGX_DEVEL_KIT_VERSION="v0.3.3" @@ -31,24 +31,24 @@ wget -nv https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz tar -zxf nginx-${NGINX_VERSION}.tar.gz -C /tmp/nginx --strip-components=1 rm nginx-${NGINX_VERSION}.tar.gz mkdir /tmp/nginx-vod-module -wget -nv https://github.com/kaltura/nginx-vod-module/archive/refs/tags/${VOD_MODULE_VERSION}.tar.gz +wget -nv https://github.com/dio-az/nginx-vod-module/archive/refs/tags/${VOD_MODULE_VERSION}.tar.gz tar -zxf ${VOD_MODULE_VERSION}.tar.gz -C /tmp/nginx-vod-module --strip-components=1 rm ${VOD_MODULE_VERSION}.tar.gz # Patch MAX_CLIPS to allow more clips to be added than the default 128 sed -i 's/MAX_CLIPS (128)/MAX_CLIPS (1080)/g' /tmp/nginx-vod-module/vod/media_set.h patch -d /tmp/nginx-vod-module/ -p1 << 'EOF' ---- a/vod/avc_hevc_parser.c 2022-06-27 11:38:10.000000000 +0000 -+++ b/vod/avc_hevc_parser.c 2023-01-16 11:25:10.900521298 +0000 -@@ -3,6 +3,9 @@ +--- a/vod/avc_hevc_parser.c ++++ b/vod/avc_hevc_parser.c +@@ -2,6 +2,9 @@ + bool_t - avc_hevc_parser_rbsp_trailing_bits(bit_reader_state_t* reader) - { + avc_hevc_parser_rbsp_trailing_bits(bit_reader_state_t* reader) { + // https://github.com/blakeblackshear/frigate/issues/4572 + return TRUE; + uint32_t one_bit; - if (reader->stream.eof_reached) + if (reader->stream.eof_reached) { EOF diff --git a/docker/main/rootfs/usr/local/nginx/conf/nginx.conf b/docker/main/rootfs/usr/local/nginx/conf/nginx.conf index f177ffd88a..d6eb985cbc 100644 --- a/docker/main/rootfs/usr/local/nginx/conf/nginx.conf +++ b/docker/main/rootfs/usr/local/nginx/conf/nginx.conf @@ -122,6 +122,10 @@ http { # Smaller segments, faster generation, better browser compatibility vod_hls_container_format fmp4; + # fMP4 playlists use EXT-X-MAP, which requires HLS protocol + # version 6 (RFC 8216 section 7); the module default is 4 + vod_hls_version 6; + secure_token $args; secure_token_types application/vnd.apple.mpegurl; @@ -130,14 +134,6 @@ http { expires off; keepalive_disable safari; - - # vod module returns 502 for non-existent media - # https://github.com/kaltura/nginx-vod-module/issues/468 - error_page 502 =404 /vod-not-found; - } - - location = /vod-not-found { - return 404; } location /stream/ { diff --git a/web/src/components/player/GenericVideoPlayer.tsx b/web/src/components/player/GenericVideoPlayer.tsx index 25399771bf..71128106bb 100644 --- a/web/src/components/player/GenericVideoPlayer.tsx +++ b/web/src/components/player/GenericVideoPlayer.tsx @@ -32,8 +32,8 @@ export function GenericVideoPlayer({ const checkSourceExists = async (url: string) => { try { const response = await fetch(url, { method: "HEAD" }); - // nginx vod module returns 502 for non existent media - // https://github.com/kaltura/nginx-vod-module/issues/468 + // missing media is a 404; 502 still covers a failed or + // unreachable mapping request, which is equally unplayable setSourceExists(response.status !== 502 && response.status !== 404); } catch (error) { setSourceExists(false);