diff --git a/docker/rootfs/usr/local/nginx/conf/nginx.conf b/docker/rootfs/usr/local/nginx/conf/nginx.conf index 8e544b045..e7f21ffed 100644 --- a/docker/rootfs/usr/local/nginx/conf/nginx.conf +++ b/docker/rootfs/usr/local/nginx/conf/nginx.conf @@ -62,11 +62,18 @@ http { vod_max_mapping_response_size 1m; vod_upstream_location /api; vod_ignore_edit_list on; + vod_segment_duration 4000; + vod_align_segments_to_key_frames on; + vod_manifest_duration_policy min; + vod_dash_manifest_format segmenttemplate; + vod_dash_profiles urn:mpeg:dash:profile:isoff-live:2011; - # vod performance https://github.com/kaltura/nginx-vod-module#performance-recommendations - vod_hls_mpegts_align_frames off; - vod_hls_mpegts_interleave_frames on; - aio on; + # file handle caching / aio + open_file_cache max=1000 inactive=5m; + open_file_cache_valid 2m; + open_file_cache_min_uses 1; + open_file_cache_errors on; + aio on; # https://github.com/kaltura/nginx-vod-module#vod_open_file_thread_pool vod_open_file_thread_pool default; @@ -77,14 +84,14 @@ http { # gzip manifests gzip on; - gzip_types application/vnd.apple.mpegurl; + gzip_types application/vnd.apple.mpegurl video/f4m application/dash+xml text/xml; location /vod/ { aio threads; - vod hls; + vod dash; secure_token $args; - secure_token_types application/vnd.apple.mpegurl; + secure_token_types application/dash+xml; add_header Access-Control-Allow-Headers '*'; add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range'; diff --git a/frigate/http.py b/frigate/http.py index 6fba3e7a1..7dcc417b6 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -1056,12 +1056,7 @@ def vod_ts(camera_name, start_ts, end_ts): clip = {"type": "source", "path": recording.path} duration = int(recording.duration * 1000) - # Determine if we need to end the last clip early - if recording.end_time > end_ts: - duration -= int((recording.end_time - end_ts) * 1000) - if duration > 0: - clip["keyFrameDurations"] = [duration] clips.append(clip) durations.append(duration) else: @@ -1076,6 +1071,7 @@ def vod_ts(camera_name, start_ts, end_ts): { "cache": hour_ago.timestamp() > start_ts, "discontinuity": False, + "consistentSequenceMediaInfo": True, "durations": durations, "segment_duration": max(durations), "sequences": [{"clips": clips}], diff --git a/web/src/routes/Events.jsx b/web/src/routes/Events.jsx index f259c31af..a130185cb 100644 --- a/web/src/routes/Events.jsx +++ b/web/src/routes/Events.jsx @@ -561,8 +561,8 @@ export default function Events({ path, ...props }) { autoplay: true, sources: [ { - src: `${apiHost}/vod/event/${event.id}/master.m3u8`, - type: 'application/vnd.apple.mpegurl', + src: `${apiHost}/vod/event/${event.id}/manifest.mpd`, + type: 'application/dash+xml', }, ], }} diff --git a/web/src/routes/Recording.jsx b/web/src/routes/Recording.jsx index 48a49c70f..05ece4751 100644 --- a/web/src/routes/Recording.jsx +++ b/web/src/routes/Recording.jsx @@ -72,8 +72,8 @@ export default function Recording({ camera, date, hour = '00', minute = '00', se src: `${apiHost}/vod/${year}-${month}/${day}/${h.hour}/${camera}/${timezone.replaceAll( '/', '_' - )}/master.m3u8`, - type: 'application/vnd.apple.mpegurl', + )}/manifest.mpd`, + type: 'application/dash+xml', }, ], };