Compare commits

..

9 Commits

Author SHA1 Message Date
Nicolas Mowen
e454daf727 Fix timezone issues with strftime (#5762)
* Fix timezone issues with strftime

* Fix timezone adjustment

* Fix bug
2023-03-18 07:32:39 -05:00
luzik
732e527401 RTSP instead of RTMP in HA integration docs (#5761)
I believe that it should be RTSP there
2023-03-18 07:29:04 -05:00
luzik
b44e6cd5dc typo in live config documentation (#5760)
I believe that we should use defined rtsp_cam_sub, not test_cam_sub
2023-03-17 17:15:38 -05:00
Blake Blackshear
2d9556f5f3 set threads to 2 (#5747) 2023-03-17 17:14:57 -05:00
Blake Blackshear
e82f72a9d3 clarify that mqtt is required in frigate config for home assistant (#5722) 2023-03-15 17:43:36 -05:00
Blake Blackshear
ce2d589a28 fix config (#5721) 2023-03-14 08:51:09 -05:00
Blake Blackshear
750bf0e79a Revert "Update ffmpeg args with low risk improvements (#5519)" (#5715)
This reverts commit 52459bf348.
2023-03-14 08:25:27 -05:00
John Ritsema
4dc6c93cdb docs: adds note about dynamic config (#4882)
* docs: adds note about dynamic config

* less technical verbiage

* removes `dynamic configuration` verbiage

* list all replaceable values
2023-03-07 06:28:51 -06:00
Nicolas Mowen
f7e9507bee Fix typo (#5655) 2023-03-06 21:06:36 -06:00
5 changed files with 49 additions and 11 deletions

View File

@@ -36,6 +36,25 @@ It is not recommended to copy this full configuration file. Only specify values
:::
**Note:** The following values will be replaced at runtime by using environment variables
- `{FRIGATE_MQTT_USER}`
- `{FRIGATE_MQTT_PASSWORD}`
- `{FRIGATE_RTSP_USER}`
- `{FRIGATE_RTSP_PASSWORD}`
for example:
```yaml
mqtt:
user: "{FRIGATE_MQTT_USER}"
password: "{FRIGATE_MQTT_PASSWORD}"
```
```yaml
- path: rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@10.0.10.10:8554/unicast
```
```yaml
mqtt:
# Optional: Enable mqtt server (default: shown below)
@@ -148,7 +167,7 @@ birdseye:
# More information about presets at https://docs.frigate.video/configuration/ffmpeg_presets
ffmpeg:
# Optional: global ffmpeg args (default: shown below)
global_args: -hide_banner -loglevel warning -threads 1
global_args: -hide_banner -loglevel warning -threads 2
# Optional: global hwaccel args (default: shown below)
# NOTE: See hardware acceleration docs for your specific device
hwaccel_args: []
@@ -157,7 +176,7 @@ ffmpeg:
# Optional: global output args
output_args:
# Optional: output args for detect streams (default: shown below)
detect: -threads 1 -f rawvideo -pix_fmt yuv420p
detect: -threads 2 -f rawvideo -pix_fmt yuv420p
# Optional: output args for record streams (default: shown below)
record: preset-record-generic
# Optional: output args for rtmp streams (default: shown below)
@@ -485,12 +504,12 @@ ui:
# Optional: Set a timezone to use in the UI (default: use browser local time)
timezone: None
# Optional: Use an experimental recordings / camera view UI (default: shown below)
experimental_ui: False
use_experimental: False
# Optional: Set the time format used.
# Options are browser, 12hour, or 24hour (default: shown below)
time_format: browser
# Optional: Set the date style for a specified length.
# Options are: full, long, medium, sort
# Options are: full, long, medium, short
# Examples:
# short: 2/11/23
# medium: Feb 11, 2023
@@ -498,7 +517,7 @@ ui:
# (default: shown below).
date_style: short
# Optional: Set the time style for a specified length.
# Options are: full, long, medium, sort
# Options are: full, long, medium, short
# Examples:
# short: 8:14 PM
# medium: 8:15:22 PM

View File

@@ -59,7 +59,7 @@ cameras:
roles:
- detect
live:
stream_name: test_cam_sub
stream_name: rtsp_cam_sub
```
### WebRTC extra configuration:

View File

@@ -16,6 +16,8 @@ See the [MQTT integration
documentation](https://www.home-assistant.io/integrations/mqtt/) for more
details.
In addition, MQTT must be enabled in your Frigate configuration file and Frigate must be connected to the same MQTT server as Home Assistant for many of the entities created by the integration to function.
### Integration installation
Available via HACS as a default repository. To install:
@@ -64,13 +66,13 @@ Home Assistant > Configuration > Integrations > Frigate > Options
| Option | Description |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| RTSP URL Template | A [jinja2](https://jinja.palletsprojects.com/) template that is used to override the standard RTMP stream URL (e.g. for use with reverse proxies). This option is only shown to users who have [advanced mode](https://www.home-assistant.io/blog/2019/07/17/release-96/#advanced-mode) enabled. See [RTSP streams](#streams) below. |
| RTSP URL Template | A [jinja2](https://jinja.palletsprojects.com/) template that is used to override the standard RTSP stream URL (e.g. for use with reverse proxies). This option is only shown to users who have [advanced mode](https://www.home-assistant.io/blog/2019/07/17/release-96/#advanced-mode) enabled. See [RTSP streams](#streams) below. |
## Entities Provided
| Platform | Description |
| --------------- | --------------------------------------------------------------------------------- |
| `camera` | Live camera stream (requires RTMP), camera for image of the last detected object. |
| `camera` | Live camera stream (requires RTSP), camera for image of the last detected object. |
| `sensor` | States to monitor Frigate performance, object counts for all zones and cameras. |
| `switch` | Switch entities to toggle detection, recordings and snapshots. |
| `binary_sensor` | A "motion" binary sensor entity per camera/zone/object. |

View File

@@ -395,11 +395,13 @@ class BirdseyeCameraConfig(BaseModel):
)
FFMPEG_GLOBAL_ARGS_DEFAULT = ["-hide_banner", "-loglevel", "warning", "-threads", "1"]
# Note: Setting threads to less than 2 caused several issues with recording segments
# https://github.com/blakeblackshear/frigate/issues/5659
FFMPEG_GLOBAL_ARGS_DEFAULT = ["-hide_banner", "-loglevel", "warning", "-threads", "2"]
FFMPEG_INPUT_ARGS_DEFAULT = "preset-rtsp-generic"
DETECT_FFMPEG_OUTPUT_ARGS_DEFAULT = [
"-threads",
"1",
"2",
"-f",
"rawvideo",
"-pix_fmt",

View File

@@ -56,7 +56,7 @@ export const formatUnixTimestampToDateTime = (unixTimestamp: number, config: Dat
// use strftime_fmt if defined in config file
if (strftime_fmt) {
const strftime_locale = strftime.localizeByIdentifier(locale);
const strftime_locale = strftime.timezone(getUTCOffset(date, timezone)).localizeByIdentifier(locale);
return strftime_locale(strftime_fmt, date);
}
@@ -114,3 +114,18 @@ export const getDurationFromTimestamps = (start_time: number, end_time: number |
}
return duration;
};
/**
* Adapted from https://stackoverflow.com/a/29268535 this takes a timezone string and
* returns the offset of that timezone from UTC in minutes.
* @param timezone string representation of the timezone the user is requesting
* @returns number of minutes offset from UTC
*/
const getUTCOffset = (date: Date, timezone: string): number => {
const utcDate = new Date(date.getTime() - (date.getTimezoneOffset() * 60 * 1000));
// locale of en-CA is required for proper locale format
let iso = utcDate.toLocaleString('en-CA', { timeZone: timezone, hour12: false }).replace(', ', 'T');
iso += '.' + utcDate.getMilliseconds().toString().padStart(3, '0');
const target = new Date(iso + 'Z');
return (target.getTime() - utcDate.getTime()) / 60 / 1000;
}