mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 17:55:21 +03:00
Use DASH instead of hls
This commit is contained in:
parent
b36266e2b2
commit
edcb1b554b
@ -62,10 +62,17 @@ http {
|
|||||||
vod_max_mapping_response_size 1m;
|
vod_max_mapping_response_size 1m;
|
||||||
vod_upstream_location /api;
|
vod_upstream_location /api;
|
||||||
vod_ignore_edit_list on;
|
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
|
# file handle caching / aio
|
||||||
vod_hls_mpegts_align_frames off;
|
open_file_cache max=1000 inactive=5m;
|
||||||
vod_hls_mpegts_interleave_frames on;
|
open_file_cache_valid 2m;
|
||||||
|
open_file_cache_min_uses 1;
|
||||||
|
open_file_cache_errors on;
|
||||||
aio on;
|
aio on;
|
||||||
|
|
||||||
# https://github.com/kaltura/nginx-vod-module#vod_open_file_thread_pool
|
# https://github.com/kaltura/nginx-vod-module#vod_open_file_thread_pool
|
||||||
@ -77,14 +84,14 @@ http {
|
|||||||
|
|
||||||
# gzip manifests
|
# gzip manifests
|
||||||
gzip on;
|
gzip on;
|
||||||
gzip_types application/vnd.apple.mpegurl;
|
gzip_types application/vnd.apple.mpegurl video/f4m application/dash+xml text/xml;
|
||||||
|
|
||||||
location /vod/ {
|
location /vod/ {
|
||||||
aio threads;
|
aio threads;
|
||||||
vod hls;
|
vod dash;
|
||||||
|
|
||||||
secure_token $args;
|
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-Allow-Headers '*';
|
||||||
add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
|
add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
|
||||||
|
|||||||
@ -1056,12 +1056,7 @@ def vod_ts(camera_name, start_ts, end_ts):
|
|||||||
clip = {"type": "source", "path": recording.path}
|
clip = {"type": "source", "path": recording.path}
|
||||||
duration = int(recording.duration * 1000)
|
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:
|
if duration > 0:
|
||||||
clip["keyFrameDurations"] = [duration]
|
|
||||||
clips.append(clip)
|
clips.append(clip)
|
||||||
durations.append(duration)
|
durations.append(duration)
|
||||||
else:
|
else:
|
||||||
@ -1076,6 +1071,7 @@ def vod_ts(camera_name, start_ts, end_ts):
|
|||||||
{
|
{
|
||||||
"cache": hour_ago.timestamp() > start_ts,
|
"cache": hour_ago.timestamp() > start_ts,
|
||||||
"discontinuity": False,
|
"discontinuity": False,
|
||||||
|
"consistentSequenceMediaInfo": True,
|
||||||
"durations": durations,
|
"durations": durations,
|
||||||
"segment_duration": max(durations),
|
"segment_duration": max(durations),
|
||||||
"sequences": [{"clips": clips}],
|
"sequences": [{"clips": clips}],
|
||||||
|
|||||||
@ -561,8 +561,8 @@ export default function Events({ path, ...props }) {
|
|||||||
autoplay: true,
|
autoplay: true,
|
||||||
sources: [
|
sources: [
|
||||||
{
|
{
|
||||||
src: `${apiHost}/vod/event/${event.id}/master.m3u8`,
|
src: `${apiHost}/vod/event/${event.id}/manifest.mpd`,
|
||||||
type: 'application/vnd.apple.mpegurl',
|
type: 'application/dash+xml',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -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(
|
src: `${apiHost}/vod/${year}-${month}/${day}/${h.hour}/${camera}/${timezone.replaceAll(
|
||||||
'/',
|
'/',
|
||||||
'_'
|
'_'
|
||||||
)}/master.m3u8`,
|
)}/manifest.mpd`,
|
||||||
type: 'application/vnd.apple.mpegurl',
|
type: 'application/dash+xml',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user