2022-11-02 05:36:09 -06:00
---
id : restream
title : Restream
---
2023-01-29 16:22:40 -07:00
## RTSP
2022-11-02 05:36:09 -06:00
2023-01-13 10:18:15 -03:00
Frigate can restream your video feed as an RTSP feed for other applications such as Home Assistant to utilize it at `rtsp://<frigate_host>:8554/<camera_name>` . Port 8554 must be open. [This allows you to use a video feed for detection in Frigate and Home Assistant live view at the same time without having to make two separate connections to the camera ](#reduce-connections-to-camera ). The video feed is copied from the original video feed directly to avoid re-encoding. This feed does not include any annotation by Frigate.
2022-11-02 05:36:09 -06:00
2025-03-12 12:54:20 -06:00
Frigate uses [go2rtc ](https://github.com/AlexxIT/go2rtc/tree/v1.9.9 ) to provide its restream and MSE/WebRTC capabilities. The go2rtc config is hosted at the `go2rtc` in the config, see [go2rtc docs ](https://github.com/AlexxIT/go2rtc/tree/v1.9.9#configuration ) for more advanced configurations and features.
2022-12-31 07:54:10 -07:00
2023-02-08 20:26:38 -07:00
:::note
2024-06-02 07:48:28 -05:00
You can access the go2rtc stream info at `/api/go2rtc/streams` which can be helpful to debug as well as provide useful information about your camera streams.
2023-02-08 20:26:38 -07:00
:::
2023-01-29 16:22:40 -07:00
### Birdseye Restream
2022-12-31 07:54:10 -07:00
2023-08-19 17:20:43 -04:00
Birdseye RTSP restream can be accessed at `rtsp://<frigate_host>:8554/birdseye` . Enabling the birdseye restream will cause birdseye to run 24/7 which may increase CPU usage somewhat.
2023-11-09 05:43:06 -07:00
2023-08-19 17:20:43 -04:00
```yaml
birdseye :
2024-09-11 19:53:58 -05:00
restream : True
2023-08-19 17:20:43 -04:00
```
2023-01-03 18:24:34 -07:00
2023-01-29 16:22:40 -07:00
### Securing Restream With Authentication
The go2rtc restream can be secured with RTSP based username / password authentication. Ex:
```yaml
go2rtc :
rtsp :
username : "admin"
password : "pass"
2023-11-09 05:43:06 -07:00
streams : ...
2023-01-29 16:22:40 -07:00
```
**NOTE:** This does not apply to localhost requests, there is no need to provide credentials when using the restream as a source for frigate cameras.
2022-11-19 06:15:20 -07:00
## Reduce Connections To Camera
Some cameras only support one active connection or you may just want to have a single connection open to the camera. The RTSP restream allows this to be possible.
### With Single Stream
One connection is made to the camera. One for the restream, `detect` and `record` connect to the restream.
```yaml
2023-01-16 16:50:35 -07:00
go2rtc :
streams :
2023-09-21 06:52:46 -06:00
name_your_rtsp_cam : # <- for RTSP streams
2023-01-18 16:50:06 -07:00
- rtsp://192.168.1.5:554/live0 # <- stream which supports video & aac audio
2023-09-21 06:52:46 -06:00
- "ffmpeg:name_your_rtsp_cam#audio=opus" # <- copy of the stream which transcodes audio to the missing codec (usually will be opus)
name_your_http_cam : # <- for other streams
2023-01-25 17:35:27 -07:00
- http://192.168.50.155/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=user&password=password # <- stream which supports video & aac audio
2023-09-21 06:52:46 -06:00
- "ffmpeg:name_your_http_cam#audio=opus" # <- copy of the stream which transcodes audio to the missing codec (usually will be opus)
2023-01-16 16:50:35 -07:00
2022-11-19 06:15:20 -07:00
cameras :
2023-09-21 06:52:46 -06:00
name_your_rtsp_cam :
2022-11-19 06:15:20 -07:00
ffmpeg :
2023-01-15 08:40:42 -07:00
output_args :
2023-01-16 16:50:35 -07:00
record : preset-record-generic-audio-copy
2022-11-19 06:15:20 -07:00
inputs :
2023-09-21 06:52:46 -06:00
- path : rtsp://127.0.0.1:8554/name_your_rtsp_cam # <--- the name here must match the name of the camera in restream
2023-01-18 16:50:06 -07:00
input_args : preset-rtsp-restream
roles :
- record
- detect
2023-07-01 07:18:33 -06:00
- audio # <- only necessary if audio detection is enabled
2023-09-21 06:52:46 -06:00
name_your_http_cam :
2023-01-18 16:50:06 -07:00
ffmpeg :
output_args :
record : preset-record-generic-audio-copy
inputs :
2023-09-21 06:52:46 -06:00
- path : rtsp://127.0.0.1:8554/name_your_http_cam # <--- the name here must match the name of the camera in restream
2023-01-15 08:40:42 -07:00
input_args : preset-rtsp-restream
2022-11-19 06:15:20 -07:00
roles :
- record
- detect
2023-07-01 07:18:33 -06:00
- audio # <- only necessary if audio detection is enabled
2022-11-19 06:15:20 -07:00
```
2023-01-19 07:14:38 -07:00
### With Sub Stream
2022-11-19 06:15:20 -07:00
Two connections are made to the camera. One for the sub stream, one for the restream, `record` connects to the restream.
```yaml
2023-01-16 16:50:35 -07:00
go2rtc :
streams :
2023-09-21 06:52:46 -06:00
name_your_rtsp_cam :
2023-01-18 16:50:06 -07:00
- rtsp://192.168.1.5:554/live0 # <- stream which supports video & aac audio. This is only supported for rtsp streams, http must use ffmpeg
2023-09-21 06:52:46 -06:00
- "ffmpeg:name_your_rtsp_cam#audio=opus" # <- copy of the stream which transcodes audio to opus
name_your_rtsp_cam_sub :
2023-01-18 16:50:06 -07:00
- rtsp://192.168.1.5:554/substream # <- stream which supports video & aac audio. This is only supported for rtsp streams, http must use ffmpeg
2023-09-21 06:52:46 -06:00
- "ffmpeg:name_your_rtsp_cam_sub#audio=opus" # <- copy of the stream which transcodes audio to opus
name_your_http_cam :
2023-01-25 17:35:27 -07:00
- http://192.168.50.155/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=user&password=password # <- stream which supports video & aac audio. This is only supported for rtsp streams, http must use ffmpeg
2023-09-21 06:52:46 -06:00
- "ffmpeg:name_your_http_cam#audio=opus" # <- copy of the stream which transcodes audio to opus
name_your_http_cam_sub :
2023-01-25 17:35:27 -07:00
- http://192.168.50.155/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=user&password=password # <- stream which supports video & aac audio. This is only supported for rtsp streams, http must use ffmpeg
2023-09-21 06:52:46 -06:00
- "ffmpeg:name_your_http_cam_sub#audio=opus" # <- copy of the stream which transcodes audio to opus
2023-01-16 16:50:35 -07:00
2022-11-19 06:15:20 -07:00
cameras :
2023-09-21 06:52:46 -06:00
name_your_rtsp_cam :
2022-11-19 06:15:20 -07:00
ffmpeg :
2023-01-15 08:40:42 -07:00
output_args :
2023-01-16 16:50:35 -07:00
record : preset-record-generic-audio-copy
2022-11-19 06:15:20 -07:00
inputs :
2023-09-21 06:52:46 -06:00
- path : rtsp://127.0.0.1:8554/name_your_rtsp_cam # <--- the name here must match the name of the camera in restream
2023-01-15 08:40:42 -07:00
input_args : preset-rtsp-restream
2022-11-19 06:15:20 -07:00
roles :
- record
2023-09-21 06:52:46 -06:00
- path : rtsp://127.0.0.1:8554/name_your_rtsp_cam_sub # <--- the name here must match the name of the camera_sub in restream
2023-01-18 16:50:06 -07:00
input_args : preset-rtsp-restream
roles :
2023-07-01 07:18:33 -06:00
- audio # <- only necessary if audio detection is enabled
2023-01-18 16:50:06 -07:00
- detect
2023-09-21 06:52:46 -06:00
name_your_http_cam :
2023-01-18 16:50:06 -07:00
ffmpeg :
output_args :
record : preset-record-generic-audio-copy
inputs :
2023-09-21 06:52:46 -06:00
- path : rtsp://127.0.0.1:8554/name_your_http_cam # <--- the name here must match the name of the camera in restream
2023-01-18 16:50:06 -07:00
input_args : preset-rtsp-restream
roles :
- record
2023-09-21 06:52:46 -06:00
- path : rtsp://127.0.0.1:8554/name_your_http_cam_sub # <--- the name here must match the name of the camera_sub in restream
2023-01-16 16:50:35 -07:00
input_args : preset-rtsp-restream
2022-11-19 06:15:20 -07:00
roles :
2023-07-01 07:18:33 -06:00
- audio # <- only necessary if audio detection is enabled
2022-11-19 06:15:20 -07:00
- detect
```
2023-01-19 07:14:38 -07:00
2024-12-04 16:54:57 -06:00
## Handling Complex Passwords
2025-03-12 12:54:20 -06:00
go2rtc expects URL-encoded passwords in the config, [urlencoder.org ](https://urlencoder.org ) can be used for this purpose.
2024-12-04 16:54:57 -06:00
For example:
```yaml
go2rtc :
streams :
my_camera : rtsp://username:$@foo%@192.168.1.100
```
becomes
```yaml
go2rtc :
streams :
my_camera : rtsp://username:$%40foo%25@192.168.1.100
```
2025-04-19 23:49:52 +02:00
See [this comment ](https://github.com/AlexxIT/go2rtc/issues/1217#issuecomment-2242296489 ) for more information.
2024-12-04 16:54:57 -06:00
2023-01-19 07:14:38 -07:00
## Advanced Restream Configurations
2025-03-12 12:54:20 -06:00
The [exec ](https://github.com/AlexxIT/go2rtc/tree/v1.9.9#source-exec ) source in go2rtc can be used for custom ffmpeg commands. An example is below:
2023-01-19 07:14:38 -07:00
NOTE: The output will need to be passed with two curly braces `{{output}}`
```yaml
go2rtc :
streams :
stream1 : exec:ffmpeg -hide_banner -re -stream_loop -1 -i /media/BigBuckBunny.mp4 -c copy -rtsp_transport tcp -f rtsp {{output}}
```