mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-09-26 20:31:11 +08:00
Update readme
This commit is contained in:
135
README.md
135
README.md
@@ -2,30 +2,31 @@
|
||||
|
||||
**go2rtc** - ultimate camera streaming application with support RTSP, WebRTC, FFmpeg, RTMP, etc.
|
||||
|
||||
- zero-dependency and zero-config small app for all OS (Windows, macOS, Linux, ARM, etc.)
|
||||
- zero-dependency and zero-config small [app for all OS](#installation) (Windows, macOS, Linux, ARM)
|
||||
- zero-delay for all supported protocols (lowest possible streaming latency)
|
||||
- zero-load on CPU for supported codecs
|
||||
- on the fly transcoding for unsupported codecs via FFmpeg
|
||||
- multi-source two-way [codecs negotiation](#codecs-negotiation)
|
||||
- streaming from private networks via Ngrok or SSH-tunnels
|
||||
- on the fly transcoding for unsupported codecs [via FFmpeg](#source-ffmpeg)
|
||||
- multi-source 2-way [codecs negotiation](#codecs-negotiation)
|
||||
- streaming from private networks via [Ngrok or SSH-tunnels](#module-webrtc)
|
||||
|
||||
## Codecs negotiation
|
||||
|
||||
For example, you want to watch stream from [Dahua IPC-K42](https://www.dahuasecurity.com/fr/products/All-Products/Network-Cameras/Wireless-Series/Wi-Fi-Series/4MP/IPC-K42) camera in your browser.
|
||||
For example, you want to watch RTSP-stream from [Dahua IPC-K42](https://www.dahuasecurity.com/fr/products/All-Products/Network-Cameras/Wireless-Series/Wi-Fi-Series/4MP/IPC-K42) camera in your Chrome browser.
|
||||
|
||||
- this camera support 2-way audio standard **ONVIF Profile T**
|
||||
- this camera support codecs **H264, H265** for send video, and you select `H264` in camera settings
|
||||
- this camera support codecs **AAC, PCMU, PCMA** for send audio (from mic), and you select `AAC/16000` in camera settings
|
||||
- this camera support codecs **AAC, PCMU, PCMA** for receive audio (to speaker), you don't need to select them
|
||||
- your browser support codecs **H264, VP8, VP9, AV1** for receive video, you don't need to select them
|
||||
- your browser support codecs **OPUS, PCMU, PCMA** for send and receive audio, you don't need to select them
|
||||
- you can't get camera audio directly, because their audio codecs doesn't match with your browser codecs
|
||||
- you can't get camera audio directly, because its audio codecs doesn't match with your browser codecs
|
||||
- so you decide to use transcoding via FFmpeg and add this setting to config YAML file
|
||||
- you have chosen `OPUS/48000/2` codec, because it is higher quality than the PCMU/8000 or PCMA/8000
|
||||
- you have chosen `OPUS/48000/2` codec, because it is higher quality than the `PCMU/8000` or `PCMA/8000`
|
||||
- now you have stream with two sources - **RTSP and FFmpeg**
|
||||
|
||||
`go2rtc` automatically match codecs for you browser and all your stream sources. This called **multi-source two-way codecs negotiation**. And this is one of the main features of this app.
|
||||
**go2rtc** automatically match codecs for you browser and all your stream sources. This called **multi-source 2-way codecs negotiation**. And this is one of the main features of this app.
|
||||
|
||||
**PS.** You can select PCMU or PCMA codec in camera setting and don't use transcoding at all. Or you can select AAC codec for main stream and PCMU codec for second stream and add both RTSP to YAML config, this also will work fine.
|
||||
**PS.** You can select `PCMU` or `PCMA` codec in camera setting and don't use transcoding at all. Or you can select `AAC` codec for main stream and `PCMU` codec for second stream and add both RTSP to YAML config, this also will work fine.
|
||||
|
||||
```yaml
|
||||
streams:
|
||||
@@ -36,45 +37,79 @@ streams:
|
||||
|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
Download binary for your OS from [latest release](https://github.com/AlexxIT/go2rtc/releases/):
|
||||
|
||||
- `go2rtc_win64.exe` - Windows 64-bit
|
||||
- `go2rtc_win32.exe` - Windows 32-bit
|
||||
- `go2rtc_linux_amd64` - Linux 64-bit
|
||||
- `go2rtc_linux_i386` - Linux 32-bit
|
||||
- `go2rtc_linux_arm64` - Linux ARM 64-bit (ex. Raspberry 64-bit OS)
|
||||
- `go2rtc_linux_arm` - Linux ARM 32-bit (ex. Raspberry 32-bit OS)
|
||||
- `go2rtc_linux_mipsel` - Linux on MIPS (ex. [Xiaomi Gateway 3](https://github.com/AlexxIT/XiaomiGateway3))
|
||||
- `go2rtc_mac_amd64` - Mac with Intel
|
||||
- `go2rtc_mac_arm64` - Mac with M1
|
||||
|
||||
Don't forget to fix the rights `chmod +x go2rtc_linux_xxx` on Linux and Mac.
|
||||
|
||||
## Configuration
|
||||
|
||||
Create file `go2rtc.yaml` next to the app. Modules:
|
||||
Create file `go2rtc.yaml` next to the app.
|
||||
|
||||
- [Streams](#streams)
|
||||
- by default, you need to config only your `streams` links
|
||||
- `api` server will start on default **3000 port**
|
||||
- `rtsp` server will start on default **554 port**
|
||||
- `webrtc` will use random UDP port for each connection
|
||||
- `ffmpeg` will use default transcoding options (you need to install it [manually](https://ffmpeg.org/))
|
||||
|
||||
### Streams
|
||||
Available modules:
|
||||
|
||||
**go2rtc** support different stream source types. You can setup only one link as stream source or multiple.
|
||||
- [streams](#module-streams)
|
||||
- [api](#module-api) - HTTP API (important for WebRTC support)
|
||||
- [rtsp](#module-rtsp) - RTSP Server (important for FFmpeg support)
|
||||
- [webrtc](#module-webrtc) - WebRTC Server (important for external access)
|
||||
- [ngrok](#module-ngrok) - Ngrok integration (external access for private network)
|
||||
- [ffmpeg](#source-ffmpeg) - FFmpeg integration
|
||||
- [hass](#source-hass) - Home Assistant integration
|
||||
- [log](#module-log) - logs config
|
||||
|
||||
- [RTSP/RTSPS](#rtsp-source) - most cameras on market
|
||||
- [RTMP](#rtmp-source)
|
||||
- [FFmpeg/Exec](#ffmpeg-source) - FFmpeg integration
|
||||
- [Hass](#hass-source) - Home Assistant integration
|
||||
### Module: Streams
|
||||
|
||||
#### RTSP source
|
||||
**go2rtc** support different stream source types. You can config only one link as stream source or multiple.
|
||||
|
||||
Available source types:
|
||||
|
||||
- [rtsp](#source-rtsp) - most cameras on market
|
||||
- [rtmp](#source-rtmp)
|
||||
- [ffmpeg](#source-ffmpeg) - FFmpeg integration
|
||||
- [exec](#source-exec) - advanced FFmpeg and GStreamer integration
|
||||
- [hass](#source-hass) - Home Assistant integration
|
||||
|
||||
#### Source: RTSP
|
||||
|
||||
- Support **RTSP and RTSPS** links with multiple video and audio tracks
|
||||
- Support **2 way audio** ONLY for [ONVIF Profile T](https://www.onvif.org/specs/stream/ONVIF-Streaming-Spec.pdf) cameras (back channel connection)
|
||||
- Support **2-way audio** ONLY for [ONVIF Profile T](https://www.onvif.org/specs/stream/ONVIF-Streaming-Spec.pdf) cameras (back channel connection)
|
||||
|
||||
**Attention:** proprietary 2 way audio standards are not supported!
|
||||
**Attention:** proprietary 2-way audio standards are not supported!
|
||||
|
||||
```yaml
|
||||
streams:
|
||||
rtsp_camera: rtsp://rtsp:12345678@192.168.1.123:554/av_stream/ch0
|
||||
sonoff_camera: rtsp://rtsp:12345678@192.168.1.123:554/av_stream/ch0
|
||||
```
|
||||
|
||||
If your camera support two RTSP links - you can add both of them as sources. This is useful when streams has different codecs, as example AAC audio with main stream and PCMU/PCMA audio with second stream:
|
||||
If your camera has two RTSP links - you can add both of them as sources. This is useful when streams has different codecs, as example AAC audio with main stream and PCMU/PCMA audio with second stream.
|
||||
|
||||
**Attention:** Dahua cameras has different capabilities for different RTSP links. For example, it has support multiple codecs for two way audio with `&proto=Onvif` in link and only one coded without it.
|
||||
**Attention:** Dahua cameras has different capabilities for different RTSP links. For example, it has support multiple codecs for 2-way audio with `&proto=Onvif` in link and only one codec without it.
|
||||
|
||||
```yaml
|
||||
streams:
|
||||
onvif_camera:
|
||||
dahua_camera:
|
||||
- rtsp://admin:password@192.168.1.123/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif
|
||||
- rtsp://admin:password@192.168.1.123/cam/realmonitor?channel=1&subtype=1
|
||||
```
|
||||
|
||||
#### RTMP source
|
||||
#### Source: RTMP
|
||||
|
||||
You can get stream from RTMP server, for example [Frigate](https://docs.frigate.video/configuration/rtmp). Support ONLY `H264` video codec without audio.
|
||||
|
||||
@@ -83,9 +118,9 @@ streams:
|
||||
rtmp_stream: rtmp://192.168.1.123/live/camera1
|
||||
```
|
||||
|
||||
#### FFmpeg source
|
||||
#### Source: FFmpeg
|
||||
|
||||
You can get any stream or file or device via FFmpeg and push it to go2rtc via RTSP protocol.
|
||||
You can get any stream or file or device via FFmpeg and push it to go2rtc. The app will automatically start FFmpeg with the proper arguments when someone starts watching the stream.
|
||||
|
||||
Format: `ffmpeg:{input}#{params}`. Examples:
|
||||
|
||||
@@ -110,7 +145,7 @@ streams:
|
||||
rtsp: ffmpeg:rtsp://rtsp:12345678@192.168.1.123:554/av_stream/ch0#video=copy&audio=copy
|
||||
```
|
||||
|
||||
All trascoding formats has built-in templates. But you can override them via YAML config:
|
||||
All trascoding formats has built-in templates. But you can override them via YAML config. You can also add your own formats to config and use them with source params.
|
||||
|
||||
```yaml
|
||||
ffmpeg:
|
||||
@@ -134,7 +169,7 @@ ffmpeg:
|
||||
aac/16000: "-codec:a aac -ar 16000 -ac 1"
|
||||
```
|
||||
|
||||
#### Exec source
|
||||
#### Source: Exec
|
||||
|
||||
FFmpeg source just a shortcut to exec source. You can get any stream or file or device via FFmpeg or GStreamer and push it to go2rtc via RTSP protocol:
|
||||
|
||||
@@ -143,9 +178,9 @@ streams:
|
||||
stream1: exec:ffmpeg -hide_banner -re -stream_loop -1 -i ~/media/BigBuckBunny.mp4 -c copy -rtsp_transport tcp -f rtsp {output}
|
||||
```
|
||||
|
||||
#### Hass source
|
||||
#### Source: Hass
|
||||
|
||||
Support import camera links from [Home Assistant](https://www.home-assistant.io/) config files.
|
||||
Support import camera links from [Home Assistant](https://www.home-assistant.io/) config files:
|
||||
|
||||
- support ONLY [Generic Camera](https://www.home-assistant.io/integrations/generic/), setup via GUI
|
||||
|
||||
@@ -157,23 +192,43 @@ streams:
|
||||
generic_camera: hass:Camera1 # Settings > Integrations > Integration Name
|
||||
```
|
||||
|
||||
### API server
|
||||
### Module: API
|
||||
|
||||
The HTTP API is the main part for interacting with the application.
|
||||
|
||||
- you can use WebRTC only when HTTP API enabled
|
||||
- you can disable HTTP API with `listen: ""` and use, for example, only RTSP client/server protocol
|
||||
- you can enable HTTP API only on localhost with `listen: "localhost:3000"` setting
|
||||
- you can change API `base_path` and host go2rtc on your main app webserver suburl
|
||||
- all files from `static_dir` hosted on root path: `/`
|
||||
|
||||
```yaml
|
||||
api:
|
||||
listen: ":3000" # HTTP API port
|
||||
listen: ":3000" # HTTP API port ("" - disabled)
|
||||
base_path: "" # API prefix for serve on suburl
|
||||
static_dir: "www" # folder for static files
|
||||
static_dir: "www" # folder for static files ("" - disabled)
|
||||
```
|
||||
|
||||
### RTSP server
|
||||
### Module: RTSP
|
||||
|
||||
You can get any stream as RTSP-stream with codecs filter:
|
||||
|
||||
```
|
||||
rtsp://192.168.1.123/{stream_name}?video={codec}&audio={codec1}&audio={codec2}
|
||||
```
|
||||
|
||||
- you can omit the codecs, so one first video and one first audio will be selected
|
||||
- you can set `?video=copy` or just `?video`, so only one first video without audio will be selected
|
||||
- you can set multiple video or audio, so all of them will be selected
|
||||
|
||||
```yaml
|
||||
rtsp:
|
||||
listen: ":554"
|
||||
```
|
||||
|
||||
### WebRTC server
|
||||
### Module: WebRTC
|
||||
|
||||
TODO...
|
||||
|
||||
```yaml
|
||||
webrtc:
|
||||
@@ -189,7 +244,9 @@ webrtc:
|
||||
credential: your_pass
|
||||
```
|
||||
|
||||
### Ngrok
|
||||
### Module: Ngrok
|
||||
|
||||
TODO...
|
||||
|
||||
```yaml
|
||||
ngrok:
|
||||
@@ -203,7 +260,9 @@ ngrok:
|
||||
command: ngrok start --all --config ngrok.yml
|
||||
```
|
||||
|
||||
### Log
|
||||
### Module: Log
|
||||
|
||||
You can set different log levels for different modules.
|
||||
|
||||
```yaml
|
||||
log:
|
||||
|
Reference in New Issue
Block a user