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);