- Notifications
You must be signed in to change notification settings - Fork826
Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
License
AlexxIT/go2rtc
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Ultimate camera streaming application with support for RTSP, WebRTC, HomeKit, FFmpeg, RTMP, etc.
- zero-dependency and zero-configsmall app for all OS (Windows, macOS, Linux, ARM)
- zero-delay for many supported protocols (lowest possible streaming latency)
- streaming fromRTSP,RTMP,DVRIP,HTTP (FLV/MJPEG/JPEG/TS),USB Cameras andother sources
- streaming from any sources, supported byFFmpeg
- streaming toRTSP,WebRTC,MSE/MP4,HomeKitHLS orMJPEG
- publish any source to popular streaming services (YouTube, Telegram, etc.)
- first project in the World with support streaming fromHomeKit Cameras
- on-the-fly transcoding for unsupported codecs viaFFmpeg
- play audio files and live streams on some cameras withspeaker
- multi-source two-waycodecs negotiation
- mixing tracks from different sources to single stream
- auto-match client-supported codecs
- two-way audio for some cameras
- can beintegrated to any smart home platform or be used asstandalone app
Inspired by:
- series of streaming projects from@deepch
- webrtc go library and whole@pion team
- rtsp-simple-server idea from@aler9
- GStreamer framework pipeline idea
- MediaSoup framework routing idea
- HomeKit Accessory Protocol from@brutella
- creator of the project's logo@v_novoseltsev
Caution
There is NO existing website for go2rtc project other than this GitHub repository. The website go2rtc[.]com is in no way associated with the authors of this project.
- Fast start
- Configuration
- Module: Streams
- Two way audio
- Source: RTSP
- Source: RTMP
- Source: HTTP
- Source: ONVIF
- Source: FFmpeg
- Source: FFmpeg Device
- Source: Exec
- Source: Echo
- Source: Expr
- Source: HomeKit
- Source: Bubble
- Source: DVRIP
- Source: Tapo
- Source: Kasa
- Source: Tuya
- Source: Xiaomi
- Source: GoPro
- Source: Ivideon
- Source: Hass
- Source: ISAPI
- Source: Nest
- Source: Ring
- Source: Roborock
- Source: Doorbird
- Source: WebRTC
- Source: WebTorrent
- Incoming sources
- Stream to camera
- Publish stream
- Preload stream
- Module: API
- Module: RTSP
- Module: RTMP
- Module: WebRTC
- Module: HomeKit
- Module: WebTorrent
- Module: ngrok
- Module: Hass
- Module: MP4
- Module: HLS
- Module: MJPEG
- Module: Log
- Module: Streams
- Security
- Codecs filters
- Codecs madness
- Codecs negotiation
- Projects using go2rtc
- Camera experience
- TIPS
- FAQ
- Downloadbinary or useDocker or Home AssistantAdd-on orIntegration
- Open web interface:
http://localhost:1984/
Optionally:
- add yourstreams toconfig file
- setupexternal access to webrtc
Developers:
- write your ownweb interface
- integrateweb api into your smart home platform
Download binary for your OS fromlatest release:
go2rtc_win64.zip- Windows 10+ 64-bitgo2rtc_win32.zip- Windows 10+ 32-bitgo2rtc_win_arm64.zip- Windows ARM 64-bitgo2rtc_linux_amd64- Linux 64-bitgo2rtc_linux_i386- Linux 32-bitgo2rtc_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_armv6- Linux ARMv6 (for old Raspberry 1 and Zero)go2rtc_linux_mipsel- Linux MIPS (ex.Xiaomi Gateway 3,Wyze cameras)go2rtc_mac_amd64.zip- macOS 11+ Intel 64-bitgo2rtc_mac_arm64.zip- macOS ARM 64-bitgo2rtc_freebsd_amd64.zip- FreeBSD 64-bitgo2rtc_freebsd_arm64.zip- FreeBSD ARM 64-bit
Don't forget to fix the rightschmod +x go2rtc_xxx_xxx on Linux and Mac.
The Docker containeralexxit/go2rtc supports multiple architectures includingamd64,386,arm64, andarm. This container offers the same functionality as theHome Assistant Add-on but is designed to operate independently of Home Assistant. It comes preinstalled withFFmpeg andPython.
- Install Add-On:
- Settings > Add-ons > Plus > Repositories > Add
https://github.com/AlexxIT/hassio-addons - go2rtc > Install > Start
- Settings > Add-ons > Plus > Repositories > Add
- SetupIntegration
WebRTC Camera custom component can be used on anyHome Assistant installation, includingHassWP on Windows. It can automatically download and use the latest version of go2rtc. Or it can connect to an existing version of go2rtc. Addon installation in this case is optional.
Latest, but maybe unstable version:
- Binary:latest nightly release
- Docker:
alexxit/go2rtc:masteroralexxit/go2rtc:master-hardwareversions - Hass Add-on:
go2rtc masterorgo2rtc master hardwareversions
- by default go2rtc will search
go2rtc.yamlin the current work directory apiserver will start on default1984 port (TCP)rtspserver will start on default8554 port (TCP)webrtcwill use port8555 (TCP/UDP) for connectionsffmpegwill use default transcoding options
Configuration options and a complete list of settings can be found inthe wiki.
Available modules:
- streams
- api - HTTP API (important for WebRTC support)
- rtsp - RTSP Server (important for FFmpeg support)
- webrtc - WebRTC Server
- mp4 - MSE, MP4 stream and MP4 snapshot Server
- hls - HLS TS or fMP4 stream Server
- mjpeg - MJPEG Server
- ffmpeg - FFmpeg integration
- ngrok - ngrok integration (external access for private network)
- hass - Home Assistant integration
- log - logs config
go2rtc supports different stream source types. You can config one or multiple links of any type as a stream source.
Available source types:
- rtsp -
RTSPandRTSPScameras withtwo-way audio support - rtmp -
RTMPstreams - http -
HTTP-FLV,MPEG-TS,JPEG(snapshots),MJPEGstreams - onvif - get camera
RTSPlink and snapshot link usingONVIFprotocol - ffmpeg - FFmpeg integration (
HLS,filesand many others) - ffmpeg:device - local USB Camera or Webcam
- exec - get media from external app output
- echo - get stream link from bash or python
- expr - get stream link via built-in expression language
- homekit - streaming from HomeKit Camera
- bubble - streaming from ESeeCloud/dvr163 NVR
- dvrip - streaming from DVR-IP NVR
- eseecloud - streaming from ESeeCloud/dvr163 NVR
- tapo - TP-Link Tapo cameras withtwo way audio support
- ring - Ring cameras withtwo way audio support
- tuya - Tuya cameras withtwo way audio support
- xiaomi - Xiaomi cameras withtwo way audio support
- kasa - TP-Link Kasa cameras
- gopro - GoPro cameras
- ivideon - public cameras fromIvideon service
- hass - Home Assistant integration
- isapi - two-way audio for Hikvision (ISAPI) cameras
- roborock - Roborock vacuums with cameras
- doorbird - Doorbird cameras withtwo way audio support
- webrtc - WebRTC/WHEP sources
- webtorrent - WebTorrent source from another go2rtc
Read more aboutincoming sources
Supported sources:
- RTSP cameras withONVIF Profile T (back channel connection)
- DVRIP cameras
- TP-Link Tapo cameras
- Hikvision ISAPI cameras
- Roborock vacuums models with cameras
- Doorbird cameras
- Exec audio on server
- Ring cameras
- Tuya cameras
- Xiaomi cameras
- Any Browser as IP-camera
Two-way audio can be used in browser withWebRTC technology. The browser will give access to the microphone only for HTTPS sites (read more).
go2rtc also supportsplay audio files and live streams on this cameras.
streams:sonoff_camera:rtsp://rtsp:12345678@192.168.1.123/av_stream/ch0dahua_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#backchannel=0amcrest_doorbell: -rtsp://username:password@192.168.1.123:554/cam/realmonitor?channel=1&subtype=0#backchannel=0unifi_camera:rtspx://192.168.1.123:7441/fD6ouM72bWoFijxKglichy_camera:ffmpeg:rtsp://username:password@192.168.1.123/live/ch00_1
Recommendations
- Amcrest Doorbell users may want to disable two-way audio, because with an active stream, you won't have a working call button. You need to add
#backchannel=0to the end of your RTSP link in YAML config file - Dahua Doorbell users may want to changeaudio codec for proper 2-way audio. Make sure not to request backchannel multiple times by adding
#backchannel=0to other stream sources of the same doorbell. Theunicast=true&proto=Onvifis preferred for 2-way audio as this makes the doorbell accept multiple codecs for the incoming audio - Reolink users may want NOT to use RTSP protocol at all, some camera models have a very awful, unusable stream implementation
- Ubiquiti UniFi users may want to disable HTTPS verification. Use
rtspx://prefix instead ofrtsps://. And don't use?enableSrtpsuffix - TP-Link Tapo users may skip login and password, because go2rtc support loginwithout them
- If your camera has two RTSP links, you can add both as sources. This is useful when streams have different codecs, for example AAC audio with main stream and PCMU/PCMA audio with second stream
- If the stream from your camera is glitchy, try usingffmpeg source. It will not add CPU load if you don't use transcoding
- If the stream from your camera is very glitchy, try to use transcoding withffmpeg source
Other options
Format:rtsp...#{param1}#{param2}#{param3}
- Add custom timeout
#timeout=30(in seconds) - Ignore audio -
#media=videoor ignore video -#media=audio - Ignore two-way audio API
#backchannel=0- important for some glitchy cameras - Use WebSocket transport
#transport=ws...
RTSP over WebSocket
streams:# WebSocket with authorization, RTSP - withoutaxis-rtsp-ws:rtsp://192.168.1.123:4567/axis-media/media.amp?overview=0&camera=1&resolution=1280x720&videoframeskipmode=empty&Axis-Orig-Sw=true#transport=ws://user:pass@192.168.1.123:4567/rtsp-over-websocket# WebSocket without authorization, RTSP - withdahua-rtsp-ws:rtsp://user:pass@192.168.1.123/cam/realmonitor?channel=1&subtype=1&proto=Private3#transport=ws://192.168.1.123/rtspoverwebsocket
You can get a stream from an RTMP server, for exampleNginx with nginx-rtmp-module.
streams:rtmp_stream:rtmp://192.168.1.123/live/camera1
Support Content-Type:
- HTTP-FLV (
video/x-flv) - same as RTMP, but over HTTP - HTTP-JPEG (
image/jpeg) - camera snapshot link, can be converted by go2rtc to MJPEG stream - HTTP-MJPEG (
multipart/x) - simple MJPEG stream over HTTP - MPEG-TS (
video/mpeg) - legacystreaming format
Source also supports HTTP and TCP streams with autodetection for different formats:MJPEG,H.264/H.265 bitstream,MPEG-TS.
streams:# [HTTP-FLV] stream in video/x-flv formathttp_flv:http://192.168.1.123:20880/api/camera/stream/780900131155/657617# [JPEG] snapshots from Dahua camera, will be converted to MJPEG streamdahua_snap:http://admin:password@192.168.1.123/cgi-bin/snapshot.cgi?channel=1# [MJPEG] stream will be proxied without modificationhttp_mjpeg:https://mjpeg.sanford.io/count.mjpeg# [MJPEG or H.264/H.265 bitstream or MPEG-TS]tcp_magic:tcp://192.168.1.123:12345# Add custom headercustom_header:"https://mjpeg.sanford.io/count.mjpeg#header=Authorization: Bearer XXX"
PS. Dahua camera has a bug: if you select MJPEG codec for RTSP second stream, snapshot won't work.
The source is not very useful if you already know RTSP and snapshot links for your camera. But it can be useful if you don't.
WebUI > Add webpage support ONVIF autodiscovery. Your server must be on the same subnet as the camera. If you use Docker, you must use "network host".
streams:dahua1:onvif://admin:password@192.168.1.123reolink1:onvif://admin:password@192.168.1.123:8000tapo1:onvif://admin:password@192.168.1.123:2020
You can get any stream, 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.
- FFmpeg preistalled forDocker andHass Add-on users
- Hass Add-on users can target files from/media folder
Format:ffmpeg:{input}#{param1}#{param2}#{param3}. Examples:
streams:# [FILE] all tracks will be copied without transcoding codecsfile1:ffmpeg:/media/BigBuckBunny.mp4# [FILE] video will be transcoded to H264, audio will be skippedfile2:ffmpeg:/media/BigBuckBunny.mp4#video=h264# [FILE] video will be copied, audio will be transcoded to PCMUfile3:ffmpeg:/media/BigBuckBunny.mp4#video=copy#audio=pcmu# [HLS] video will be copied, audio will be skippedhls:ffmpeg:https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/gear5/prog_index.m3u8#video=copy# [MJPEG] video will be transcoded to H264mjpeg:ffmpeg:http://185.97.122.128/cgi-bin/faststream.jpg#video=h264# [RTSP] video with rotation, should be transcoded, so select H264rotate:ffmpeg:rtsp://12345678@192.168.1.123/av_stream/ch0#video=h264#rotate=90
All transcoding formats havebuilt-in templates:h264,h265,opus,pcmu,pcmu/16000,pcmu/48000,pcma,pcma/16000,pcma/48000,aac,aac/16000.
But you can override them via YAML config. You can also add your own formats to the config and use them with source params.
ffmpeg:bin:ffmpeg# path to ffmpeg binaryh264:"-codec:v libx264 -g:v 30 -preset:v superfast -tune:v zerolatency -profile:v main -level:v 4.1"mycodec:"-any args that supported by ffmpeg..."myinput:"-fflags nobuffer -flags low_delay -timeout 5000000 -i {input}"myraw:"-ss 00:00:20"
- You can use go2rtc stream name as ffmpeg input (ex.
ffmpeg:camera1#video=h264) - You can use
videoandaudioparams multiple times (ex.#video=copy#audio=copy#audio=pcmu) - You can use
rotateparam with90,180,270or-90values, important with transcoding (ex.#video=h264#rotate=90) - You can use
widthand/orheightparams, important with transcoding (ex.#video=h264#width=1280) - You can use
drawtextto add a timestamp (ex.drawtext=x=2:y=2:fontsize=12:fontcolor=white:box=1:boxcolor=black)- This will greatly increase the CPU of the server, even with hardware acceleration
- You can use
rawparam for any additional FFmpeg arguments (ex.#raw=-vf transpose=1) - You can use
inputparam to override default input template (ex.#input=rtsp/udpwill change RTSP transport from TCP to UDP+TCP)- You can use raw input value (ex.
#input=-timeout 5000000 -i {input}) - You can add your own input templates
- You can use raw input value (ex.
Read more abouthardware acceleration.
PS. It is recommended to check the available hardware in the WebUI add page.
You can get video from any USB camera or Webcam as RTSP or WebRTC stream. This is part of FFmpeg integration.
- check available devices in web interface
video_sizeandframeratemust be supported by your camera!- for Linux supported only video for now
- for macOS you can stream FaceTime camera or whole desktop!
- for macOS important to set right framerate
Format:ffmpeg:device?{input-params}#{param1}#{param2}#{param3}
streams:linux_usbcam:ffmpeg:device?video=0&video_size=1280x720#video=h264windows_webcam:ffmpeg:device?video=0#video=h264macos_facetime:ffmpeg:device?video=0&audio=1&video_size=1280x720&framerate=30#video=h264#audio=pcma
PS. It is recommended to check the available devices in the WebUI add page.
Exec source can run any external application and expect data from it. Two transports are supported -pipe (fromv1.5.0) andRTSP.
If you want to useRTSP transport, the command must contain the{output} argument in any place. On launch, it will be replaced by the local address of the RTSP server.
pipe reads data from app stdout in different formats:MJPEG,H.264/H.265 bitstream,MPEG-TS. Also pipe can write data to app stdin in two formats:PCMA andPCM/48000.
The source can be used with:
- FFmpeg - go2rtc ffmpeg source just a shortcut to exec source
- FFplay - play audio on your server
- GStreamer
- Raspberry Pi Cameras
- any of your own software
Pipe commands support parameters (format:exec:{command}#{param1}#{param2}):
killsignal- signal which will be sent to stop the process (numeric form)killtimeout- time in seconds for forced termination with sigkillbackchannel- enable backchannel for two-way audio
streams:stream:exec:ffmpeg -re -i /media/BigBuckBunny.mp4 -c copy -rtsp_transport tcp -f rtsp {output}picam_h264:exec:libcamera-vid -t 0 --inline -o -picam_mjpeg:exec:libcamera-vid -t 0 --codec mjpeg -o -pi5cam_h264:exec:libcamera-vid -t 0 --libav-format h264 -o -canon:exec:gphoto2 --capture-movie --stdout#killsignal=2#killtimeout=5play_pcma:exec:ffplay -fflags nobuffer -f alaw -ar 8000 -i -#backchannel=1play_pcm48k:exec:ffplay -fflags nobuffer -f s16be -ar 48000 -i -#backchannel=1
Some sources may have a dynamic link. And you will need to get it using a Bash or Python script. Your script should echo a link to the source. RTSP, FFmpeg or any of thesupported sources.
Docker andHass Add-on users has preinstalledpython3,curl,jq.
Check examples inwiki.
streams:apple_hls:echo:python3 hls.py https://developer.apple.com/streaming/examples/basic-stream-osx-ios5.html
Likeecho source, but uses the built-inexpr expression language (read more).
Important:
- You can use HomeKit Cameraswithout Apple devices (iPhone, iPad, etc.), it's just a yet another protocol
- HomeKit device can be paired with only one ecosystem. So, if you have paired it to an iPhone (Apple Home), you can't pair it with Home Assistant or go2rtc. Or if you have paired it to go2rtc, you can't pair it with an iPhone
- HomeKit device should be on the same network with workingmDNS between the device and go2rtc
go2rtc supports importing paired HomeKit devices fromHome Assistant. So you can use HomeKit camera with Hass and go2rtc simultaneously. If you are using Hass, I recommend pairing devices with it; it will give you more options.
You can pair device with go2rtc on the HomeKit page. If you can't see your devices, reload the page. Also, try rebooting your HomeKit device (power off). If you still can't see it, you have a problem with mDNS.
If you see a device but it does not have a pairing button, it is paired to some ecosystem (Apple Home, Home Assistant, HomeBridge etc). You need to delete the device from that ecosystem, and it will be available for pairing. If you cannot unpair the device, you will have to reset it.
Important:
- HomeKit audio uses very non-standardAAC-ELD codec with very non-standard params and specification violations
- Audio can't be played in
VLCand probably any other player - Audio should be transcoded for use with MSE, WebRTC, etc.
Recommended settings for using HomeKit Camera with WebRTC, MSE, MP4, RTSP:
streams: aqara_g3: - hass:Camera-Hub-G3-AB12 - ffmpeg:aqara_g3#audio=aac#audio=opusRTSP link with "normal" audio for any player:rtsp://192.168.1.123:8554/aqara_g3?video&audio=aac
This source is in active development! Tested only withAqara Camera Hub G3 (both EU and CN versions).
- you can skip
username,password,port,chandstreamif they are default - set up separate streams for different channels and streams
streams:camera1:bubble://username:password@192.168.1.123:34567/bubble/live?ch=0&stream=0
Other names: DVR-IP, NetSurveillance, Sofia protocol (NETsurveillance ActiveX plugin XMeye SDK).
- you can skip
username,password,port,channelandsubtypeif they are default - set up separate streams for different channels
- use
subtype=0for Main stream, andsubtype=1for Extra1 stream - only the TCP protocol is supported
streams:only_stream:dvrip://username:password@192.168.1.123:34567?channel=0&subtype=0only_tts:dvrip://username:password@192.168.1.123:34567?backchannel=1two_way_audio: -dvrip://username:password@192.168.1.123:34567?channel=0&subtype=0 -dvrip://username:password@192.168.1.123:34567?backchannel=1
streams:camera1:eseecloud://user:pass@192.168.1.123:80/livestream/12
TP-Link Tapo proprietary camera protocol withtwo way audio support.
- stream quality is the same asRTSP protocol
- use thecloud password, this is not the RTSP password! you do not need to add a login!
- you can also useUPPERCASE MD5 hash from your cloud password with
adminusername - some new camera firmwares require SHA256 instead of MD5
streams:# cloud password without usernamecamera1:tapo://cloud-password@192.168.1.123# admin username and UPPERCASE MD5 cloud-password hashcamera2:tapo://admin:UPPERCASE-MD5@192.168.1.123# admin username and UPPERCASE SHA256 cloud-password hashcamera3:tapo://admin:UPPERCASE-SHA256@192.168.1.123# VGA stream (the so called substream, the lower resolution one)camera4:tapo://cloud-password@192.168.1.123?subtype=1# HD stream (default)camera5:tapo://cloud-password@192.168.1.123?subtype=0
echo -n"cloud password"| md5| awk'{print toupper($0)}'echo -n"cloud password"| shasum -a 256| awk'{print toupper($0)}'
TP-Link Kasa non-standard protocolmore info.
username- urlsafe email,alex@gmail.com->alex%40gmail.compassword- base64password,secret1->c2VjcmV0MQ==
streams:kc401:kasa://username:password@192.168.1.123:19443/https/stream/mixed
Tested: KD110, KC200, KC401, KC420WS, EC71.
Tuya proprietary camera protocol withtwo way audio support. Go2rtc supportsTuya Smart API andTuya Cloud API.Read more.
This source allows you to view cameras from theXiaomi Mi Home ecosystem.Read more.
Support streaming fromGoPro cameras, connected via USB or Wi-Fi to Linux, Mac, Windows.Read more.
Support public cameras from the serviceIvideon.
streams:quailcam:ivideon:100-tu5dkUPct39cTp9oNEN2B6/0
Support import camera links fromHome Assistant config files:
- Generic Camera, setup via GUI
- HomeKit Camera
- ONVIF
- Roborock vacuums with camera
hass:config:"/config"# skip this setting if you Hass add-on userstreams:generic_camera:hass:Camera1# Settings > Integrations > Integration Nameaqara_g3:hass:Camera-Hub-G3-AB12
WebRTC Cameras (fromv1.6.0)
Any cameras in WebRTC format are supported. But at the moment Home Assistant only supports someNest cameras in this format.
Important. The Nest API only allows you to get a link to a stream for 5 minutes. Do not use this with Frigate! If the stream expires, Frigate will consume all available RAM on your machine within seconds. It's recommended to useNest source - it supports extending the stream.
streams:# link to Home Assistant Supervisedhass-webrtc1:hass://supervisor?entity_id=camera.nest_doorbell# link to external Hass with Long-Lived Access Tokenshass-webrtc2:hass://192.168.1.123:8123?entity_id=camera.nest_doorbell&token=eyXYZ...
RTSP Cameras
By default, the Home Assistant API does not allow you to get a dynamic RTSP link to a camera stream. So more cameras, likeTuya, and possibly others, can also be imported usingthis method.
This source type supports only backchannel audio for the Hikvision ISAPI protocol. So it should be used as a second source in addition to the RTSP protocol.
streams:hikvision1: -rtsp://admin:password@192.168.1.123:554/Streaming/Channels/101 -isapi://admin:password@192.168.1.123:80/
Currently, only WebRTC cameras are supported.
For simplicity, it is recommended to connect the Nest/WebRTC camera to theHome Assistant. But if you can somehow get the below parameters, Nest/WebRTC source will work without Hass.
streams:nest-doorbell:nest:?client_id=***&client_secret=***&refresh_token=***&project_id=***&device_id=***
This source type support Ring cameras withtwo way audio support. If you have arefresh_token anddevice_id - you can use it ingo2rtc.yaml config file. Otherwise, you can use the go2rtc interface and add your ring account (WebUI > Add > Ring). Once added, it will list all your Ring cameras.
streams:ring:ring:?device_id=XXX&refresh_token=XXXring_snapshot:ring:?device_id=XXX&refresh_token=XXX&snapshot
This source type supports Roborock vacuums with cameras. Known working models:
- Roborock S6 MaxV - only video (the vacuum has no microphone)
- Roborock S7 MaxV - video and two-way audio
- Roborock Qrevo MaxV - video and two-way audio
Source supports loading Roborock credentials from Home Assistantcustom integration or thecore integration. Otherwise, you need to log in to your Roborock account (MiHome account is not supported). Go to: go2rtc WebUI > Add webpage. Copyroborock://... source for your vacuum and paste it togo2rtc.yaml config.
If you have a graphic PIN for your vacuum, add it as a numeric PIN (lines: 123, 456, 789) to the end of theroborock link.
This source type supports Doorbird devices including MJPEG stream, audio stream as well as two-way audio.
streams:doorbird1: -rtsp://admin:password@192.168.1.123:8557/mpeg/720p/media.amp# RTSP stream -doorbird://admin:password@192.168.1.123?media=video# MJPEG stream -doorbird://admin:password@192.168.1.123?media=audio# audio stream -doorbird://admin:password@192.168.1.123# two-way audio
This source type supports four connection formats.
whep
WebRTC/WHEP is replaced byWebRTC/WISH standard for WebRTC video/audio viewers. But it may already be supported in some third-party software. It is supported in go2rtc.
go2rtc
This format is only supported in go2rtc. Unlike WHEP, it supports asynchronous WebRTC connections and two-way audio.
openipc (fromv1.7.0)
Support connection toOpenIPC cameras.
wyze (fromv1.6.1)
Supports connection toWyze cameras, using WebRTC protocol. You can use thedocker-wyze-bridge project to get connection credentials.
kinesis (fromv1.6.1)
SupportsAmazon Kinesis Video Streams, using WebRTC protocol. You need to specify the signalling WebSocket URL with all credentials in query params,client_id andice_servers list inJSON format.
switchbot
Support connection toSwitchBot cameras that are based on Kinesis Video Streams. Specifically, this includesPan/Tilt Cam Plus 2K andPan/Tilt Cam Plus 3K andSmart Video Doorbell.Outdoor Spotlight Cam 1080P,Outdoor Spotlight Cam 2K,Pan/Tilt Cam,Pan/Tilt Cam 2K,Indoor Cam are based on Tuya, so this feature is not available.
streams:webrtc-whep:webrtc:http://192.168.1.123:1984/api/webrtc?src=camera1webrtc-go2rtc:webrtc:ws://192.168.1.123:1984/api/ws?src=camera1webrtc-openipc:webrtc:ws://192.168.1.123/webrtc_ws#format=openipc#ice_servers=[{"urls":"stun:stun.kinesisvideo.eu-north-1.amazonaws.com:443"}]webrtc-wyze:webrtc:http://192.168.1.123:5000/signaling/camera1?kvs#format=wyzewebrtc-kinesis:webrtc:wss://...amazonaws.com/?...#format=kinesis#client_id=...#ice_servers=[{...},{...}]webrtc-switchbot:webrtc:wss://...amazonaws.com/?...#format=switchbot#resolution=hd#play_type=0#client_id=...#ice_servers=[{...},{...}]
PS. Forkinesis sources, you can useecho to get connection params usingbash,python or any other script language.
This source can get a stream from another go2rtc viaWebTorrent protocol.
streams:webtorrent1:webtorrent:?share=huofssuxaty00izc&pwd=k3l2j9djeg8v8r7e
By default, go2rtc establishes a connection to the source when any client requests it. Go2rtc drops the connection to the source when it has no clients left.
- Go2rtc also can accepts incoming sources inRTSP,RTMP,HTTP andWebRTC/WHIP formats
- Go2rtc won't stop such a source if it has no clients
- You can push data only to an existing stream (create a stream with empty source in config)
- You can push multiple incoming sources to the same stream
- You can push data to a non-empty stream, so it will have additional codecs inside
Examples
- RTSP with any codec
ffmpeg -re -i BigBuckBunny.mp4 -c copy -rtsp_transport tcp -f rtsp rtsp://localhost:8554/camera1 - HTTP-MJPEG with MJPEG codec
ffmpeg -re -i BigBuckBunny.mp4 -c mjpeg -f mpjpeg http://localhost:1984/api/stream.mjpeg?dst=camera1 - HTTP-FLV with H264, AAC codecs
ffmpeg -re -i BigBuckBunny.mp4 -c copy -f flv http://localhost:1984/api/stream.flv?dst=camera1 - MPEG-TS with H264 codec
ffmpeg -re -i BigBuckBunny.mp4 -c copy -f mpegts http://localhost:1984/api/stream.ts?dst=camera1
You can turn the browser of any PC or mobile into an IP camera with support for video and two-way audio. Or even broadcast your PC screen:
- Create empty stream in the
go2rtc.yaml - Go to go2rtc WebUI
- Open
linkspage for your stream - Select
camera+microphoneordisplay+speakeroption - Open
webrtclocal page (your go2rtcshould work over HTTPS!) orshare linkviaWebTorrent technology (work over HTTPS by default)
You can useOBS Studio or any other broadcast software withWHIP protocol support. This standard has not yet been approved. But you can download OBS Studiodev version:
- Settings > Stream > Service: WHIP >http://192.168.1.123:1984/api/webrtc?dst=camera1
go2rtc supports playing audio files (ex. music orTTS) and live streams (ex. radio) on cameras withtwo-way audio support (RTSP/ONVIF cameras, TP-Link Tapo, Hikvision ISAPI, Roborock vacuums, any Browser).
API example:
POST http://localhost:1984/api/streams?dst=camera1&src=ffmpeg:http://example.com/song.mp3#audio=pcma#input=file- you can stream: local files, web files, live streams or any format, supported by FFmpeg
- you should useffmpeg source for transcoding audio to codec, that your camera supports
- you can check camera codecs on the go2rtc WebUI info page when the stream is active
- some cameras support only low quality
PCMA/8000codec (ex.Tapo) - it is recommended to choose higher quality formats if your camera supports them (ex.
PCMA/48000for some Dahua cameras) - if you play files over
httplink, you need to add#input=fileparams for transcoding, so the file will be transcoded and played in real time - if you play live streams, you should skip
#inputparam, because it is already in real time - you can stop active playback by calling the API with the empty
srcparameter - you will see one active producer and one active consumer in go2rtc WebUI info page during streaming
You can publish any stream to streaming services (YouTube, Telegram, etc.) via RTMP/RTMPS. Important:
- Supported codecs: H264 for video and AAC for audio
- AAC audio is required for YouTube; videos without audio will not work
- You don't need to enableRTMP module listening for this task
You can use the API:
POST http://localhost:1984/api/streams?src=camera1&dst=rtmps://...Or config file:
publish:# publish stream "video_audio_transcode" to Telegramvideo_audio_transcode: -rtmps://xxx-x.rtmp.t.me/s/xxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxx# publish stream "audio_transcode" to Telegram and YouTubeaudio_transcode: -rtmps://xxx-x.rtmp.t.me/s/xxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxx -rtmp://xxx.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx-xxxxstreams:video_audio_transcode: -ffmpeg:rtsp://user:pass@192.168.1.123/stream1#video=h264#hardware#audio=aacaudio_transcode: -ffmpeg:rtsp://user:pass@192.168.1.123/stream1#video=copy#audio=aac
- Telegram Desktop App > Any public or private channel or group (where you admin) > Live stream > Start with... > Start streaming.
- YouTube > Create > Go live > Stream latency: Ultra low-latency > Copy: Stream URL + Stream key.
You can preload any stream on go2rtc start. This is useful for cameras that take a long time to start up.
preload:camera1:# default: video&audio = ANYcamera2:"video"# preload only video trackcamera3:"video=h264&audio=opus"# preload H264 video and OPUS audiostreams:camera1: -rtsp://192.168.1.100/streamcamera2: -rtsp://192.168.1.101/streamcamera3: -rtsp://192.168.1.102/h265stream -ffmpeg:camera3#video=h264#audio=opus#hardware
The HTTP API is the main part for interacting with the application. Default address:http://localhost:1984/.
Important! go2rtc passes requests from localhost and from Unix sockets without HTTP authorisation, even if you have it configured! It is your responsibility to set up secure external access to the API. If not properly configured, an attacker can gain access to your cameras and even your server.
Module config
- 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: "127.0.0.1:1984"setting - you can change the API
base_pathand host go2rtc on your main app webserver suburl - all files from
static_dirhosted on root path:/ - you can use raw TLS cert/key content or path to files
api:listen:":1984"# default ":1984", HTTP API port ("" - disabled)username:"admin"# default "", Basic auth for WebUIpassword:"pass"# default "", Basic auth for WebUIlocal_auth:true# default false, Enable auth check for localhost requestsbase_path:"/rtc"# default "", API prefix for serving on suburl (/api => /rtc/api)static_dir:"www"# default "", folder for static files (custom web interface)origin:"*"# default "", allow CORS requests (only * supported)tls_listen:":443"# default "", enable HTTPS servertls_cert:|# default "", PEM-encoded fullchain certificate for HTTPS -----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----tls_key:|# default "", PEM-encoded private key for HTTPS -----BEGIN PRIVATE KEY----- ... -----END PRIVATE KEY-----unix_listen:"/tmp/go2rtc.sock"# default "", unix socket listener for API
PS:
- MJPEG over WebSocket plays better than native MJPEG because Chromebug
- MP4 over WebSocket was created only for Apple iOS because it doesn't support MSE and native MP4
You can get any stream as RTSP-stream:rtsp://192.168.1.123:8554/{stream_name}
You can enable external password protection for your RTSP streams. Password protection is always disabled for localhost calls (ex. FFmpeg or Hass on the same server).
rtsp:listen:":8554"# RTSP Server TCP port, default - 8554username:"admin"# optional, default - disabledpassword:"pass"# optional, default - disableddefault_query:"video&audio"# optional, default codecs filters
By default go2rtc provide RTSP-stream with only one first video and only one first audio. You can change it with thedefault_query setting:
default_query: "mp4"- MP4 compatible codecs (H264, H265, AAC)default_query: "video=all&audio=all"- all tracks from all source (not all players can handle this)default_query: "video=h264,h265"- only one video track (H264 or H265)default_query: "video&audio=all"- only one first any video and all audio as separate tracks
Read more aboutcodecs filters.
You can get any stream as RTMP-stream:rtmp://192.168.1.123/{stream_name}. Only H264/AAC codecs supported right now.
Incoming stream in RTMP format tested only withOBS Studio and a Dahua camera. Different FFmpeg versions have different problems with this format.
rtmp:listen:":1935"# by default - disabled!
In most cases,WebRTC uses a direct peer-to-peer connection from your browser to go2rtc and sends media data via UDP.Itcan't pass media data through your Nginx or Cloudflare orNabu Casa HTTP TCP connection!It can automatically detect your external IP via a publicSTUN server.It can establish an external direct connection viaUDP hole punching technology even if you do not open your server to the World.
But about 10-20% of users may need to configure additional settings for external access ifmobile phone orgo2rtc server is behindSymmetric NAT.
- by default, WebRTC uses both TCP and UDP on port 8555 for connections
- you can use this port for external access
- you can change the port in YAML config:
webrtc:listen:":8555"# address of your local server and port (TCP/UDP)
Static public IP
- forward the port 8555 on your router (you can use the same 8555 port or any other as external port)
- add your external IP address and external port to the YAML config
webrtc:candidates: -216.58.210.174:8555# if you have a static public IP address
Dynamic public IP
- forward the port 8555 on your router (you can use the same 8555 port or any other as the external port)
- add
stunword and external port to YAML config- go2rtc automatically detects your external address with STUN server
webrtc:candidates: -stun:8555# if you have a dynamic public IP address
Hard tech way 1. Own TCP-tunnel
If you have a personalVPS, you can create a TCP tunnel and setup in the same way as "Static public IP". But use your VPS IP address in the YAML config.
Hard tech way 2. Using TURN-server
If you have personalVPS, you can install TURN server (e.g.coturn, configexample).
webrtc:ice_servers: -urls:[stun:stun.l.google.com:19302] -urls:[turn:123.123.123.123:3478]username:your_usercredential:your_pass
HomeKit module can work in two modes:
- export any H264 camera to Apple HomeKit
- transparent proxy any Apple HomeKit camera (Aqara, Eve, Eufy, etc.) back to Apple HomeKit, so you will have all camera features in Apple Home and also will have RTSP/WebRTC/MP4/etc. from your HomeKit camera
Important
- HomeKit cameras support only H264 video and OPUS audio
Minimal config
streams:dahua1:rtsp://admin:password@192.168.1.123/cam/realmonitor?channel=1&subtype=0homekit:dahua1:# same stream ID from streams list, default PIN - 19550224
Full config
streams:dahua1: -rtsp://admin:password@192.168.1.123/cam/realmonitor?channel=1&subtype=0 -ffmpeg:dahua1#video=h264#hardware# if your camera doesn't support H264, important for HomeKit -ffmpeg:dahua1#audio=opus# only OPUS audio supported by HomeKithomekit:dahua1:# same stream ID from streams listpin:12345678# custom PIN, default: 19550224name:Dahua camera# custom camera name, default: generated from stream IDdevice_id:dahua1# custom ID, default: generated from stream IDdevice_private:dahua1# custom key, default: generated from stream ID
Proxy HomeKit camera
- Video stream from HomeKit camera to Apple device (iPhone, AppleTV) will be transmitted directly
- Video stream from HomeKit camera to RTSP/WebRTC/MP4/etc. will be transmitted via go2rtc
streams:aqara1: -homekit://... -ffmpeg:aqara1#audio=aac#audio=opus# optional audio transcodinghomekit:aqara1:# same stream ID from streams list
This module supports:
- Share any local stream viaWebTorrent technology
- Get anyincoming stream from PC or mobile viaWebTorrent technology
- Get any remotego2rtc source viaWebTorrent technology
Securely and freely. You do not need to open a public access to the go2rtc server. But in some cases (Symmetric NAT), you may need to set up external access toWebRTC module.
To generate a sharing link or incoming link, go to the go2rtc WebUI (stream links page). This link istemporary and will stop working after go2rtc is restarted!
You can create permanent external links in the go2rtc config:
webtorrent:shares:super-secret-share:# share name, should be unique among all go2rtc users!pwd:super-secret-passwordsrc:rtsp-dahua1# stream name from streams section
Link example:https://alexxit.github.io/go2rtc/#share=02SNtgjKXY&pwd=wznEQqznxW&media=video+audio
Withngrok integration, you can get external access to your streams in situations when you have Internet with a private IP address (read more).
The best and easiest way to use go2rtc inside Home Assistant is to install the custom integrationWebRTC Camera and custom Lovelace card.
But go2rtc is also compatible and can be used with theRTSPtoWebRTC built-in integration.
You have several options on how to add a camera to Home Assistant:
- Camera RTSP source =>Generic Camera
- Cameraany source =>go2rtc config =>Generic Camera
- Install anygo2rtc
- Add your stream togo2rtc config
- Hass > Settings > Integrations > Add Integration >ONVIF > Host:
127.0.0.1, Port:1984 - Hass > Settings > Integrations > Add Integration >Generic Camera > Stream Source URL:
rtsp://127.0.0.1:8554/camera1(change to your stream name, leave everything else as is)
You have several options on how to watch the stream from the cameras in Home Assistant:
Camera Entity=>Picture Entity Card=> TechnologyHLS, codecs:H264/H265/AAC, poor latency.Camera Entity=>RTSPtoWebRTC =>Picture Entity Card=> TechnologyWebRTC, codecs:H264/PCMU/PCMA/OPUS, best latency.- Install anygo2rtc
- Hass > Settings > Integrations > Add Integration >RTSPtoWebRTC >
http://127.0.0.1:1984/ - RTSPtoWebRTC > Configure > STUN server:
stun.l.google.com:19302 - Use Picture Entity or Picture Glance Lovelace card
Camera EntityorCamera URL=>WebRTC Camera => Technology:WebRTC/MSE/MP4/MJPEG, codecs:H264/H265/AAC/PCMU/PCMA/OPUS, best latency, best compatibility.- Install and addWebRTC Camera custom integration
- Use WebRTC Camera custom Lovelace card
You can add cameraentity_id togo2rtc config if you need transcoding:
streams:"camera.hall":ffmpeg:{input}#video=copy#audio=opus
PS. Default Home Assistant lovelace cards don't support two-way audio. You can use 2-way audio fromAdd-on Web UI, but you need to use HTTPS to access the microphone. This is a browser restriction and cannot be avoided.
PS. There is also another nice card with go2rtc support -Frigate Lovelace Card.
Provides several features:
- MSE stream (fMP4 over WebSocket)
- Camera snapshots in MP4 format (single frame), can be sent toTelegram
- HTTP progressive streaming (MP4 file stream) - bad format for streaming because of high start delay. This format doesn't work in all Safari browsers, but go2rtc will automatically redirect it to HLS/fMP4 in this case.
API examples:
- MP4 snapshot:
http://192.168.1.123:1984/api/frame.mp4?src=camera1(H264, H265) - MP4 stream:
http://192.168.1.123:1984/api/stream.mp4?src=camera1(H264, H265, AAC) - MP4 file:
http://192.168.1.123:1984/api/stream.mp4?src=camera1(H264, H265*, AAC, OPUS, MP3, PCMA, PCMU, PCM)- You can use
mp4,mp4=flacandmp4=allparam for codec filters - You can use
durationparam in seconds (ex.duration=15) - You can use
filenameparam (ex.filename=record.mp4) - You can use
rotateparam with90,180or270values - You can use
scaleparam with positive integer values (ex.scale=4:3)
- You can use
Read more aboutcodecs filters.
PS. Rotate and scale params don't use transcoding and change video using metadata.
HLS is the worst technology for real-time streaming. It can only be useful on devices that do not support more modern technology, likeWebRTC,MSE/MP4.
The go2rtc implementation differs from the standards and may not work with all players.
API examples:
- HLS/TS stream:
http://192.168.1.123:1984/api/stream.m3u8?src=camera1(H264) - HLS/fMP4 stream:
http://192.168.1.123:1984/api/stream.m3u8?src=camera1&mp4(H264, H265, AAC)
Read more aboutcodecs filters.
Important. For stream in MJPEG format, your source MUST contain the MJPEG codec. If your stream has an MJPEG codec, you can receiveMJPEG stream orJPEG snapshots via API.
You can receive an MJPEG stream in several ways:
- some cameras support MJPEG codec insideRTSP stream (ex. second stream for Dahua cameras)
- some cameras have an HTTP link withMJPEG stream
- some cameras have an HTTP link with snapshots - go2rtc can convert them toMJPEG stream
- you can convert H264/H265 stream from your camera viaFFmpeg integraion
With this example, your stream will have both H264 and MJPEG codecs:
streams:camera1: -rtsp://rtsp:12345678@192.168.1.123/av_stream/ch0 -ffmpeg:camera1#video=mjpeg
API examples:
- MJPEG stream:
http://192.168.1.123:1984/api/stream.mjpeg?src=camera1 - JPEG snapshots:
http://192.168.1.123:1984/api/frame.jpeg?src=camera1- You can use
width/wand/orheight/hparams - You can use
rotateparam with90,180,270or-90values - You can use
hardware/hwparamread more
- You can use
PS. This module also supports streaming to the server console (terminal) in theanimated ASCII art format (read more):
You can set different log levels for different modules.
log:level:info# default levelapi:traceexec:debugrtsp:warnstreams:errorwebrtc:fatal
Important
If an attacker gains access to the API, you are in danger. Through the API, an attacker can use insecure sources such as echo and exec. And get full access to your server.
For maximum (paranoid) security, go2rtc has special settings:
app:# use only allowed modulesmodules:[api, rtsp, webrtc, exec, ffmpeg, mjpeg]api:# use only allowed API pathsallow_paths:[/api, /api/streams, /api/webrtc, /api/frame.jpeg]# enable auth for localhost (used together with username and password)local_auth:trueexec:# use only allowed exec pathsallow_paths:[ffmpeg]
By default,go2rtc starts the Web interface on port1984 and RTSP on port8554, as well as uses port8555 for WebRTC connections. The three ports are accessible from your local network. So anyone on your local network can watch video from your cameras without authorization. The same rule applies to the Home Assistant Add-on.
This is not a problem if you trust your local network as much as I do. But you can change this behaviour with ago2rtc.yaml config:
api:listen:"127.0.0.1:1984"# localhostrtsp:listen:"127.0.0.1:8554"# localhostwebrtc:listen:":8555"# external TCP/UDP port
- local access to RTSP is not a problem forFFmpeg integration, because it runs locally on your server
- local access to API is not a problem for theHome Assistant add-on, because Hass runs locally on the same server, and the add-on web UI is protected with Hass authorization (Ingress feature)
- external access to WebRTC TCP port is not a problem, because it is used only for transmitting encrypted media data
- anyway you need to open this port to your local network and to the Internet for WebRTC to work
If you need web interface protection without the Home Assistant add-on, you need to use a reverse proxy, likeNginx,Caddy, etc.
PS. Additionally, WebRTC will try to use the 8555 UDP port to transmit encrypted media. It works without problems on the local network, and sometimes also works for external access, even if you haven't opened this port on your router (read more). But for stable external WebRTC access, you need to open the 8555 port on your router for both TCP and UDP.
go2rtc can automatically detect which codecs your device supports forWebRTC andMSE technologies.
But it cannot be done forRTSP,HTTP progressive streaming,HLS technologies. You can manually add a codec filter when you create a link to a stream. The filters work the same for all three technologies. Filters do not create a new codec. They only select the suitable codec from existing sources. You can add new codecs to the stream using theFFmpeg transcoding.
Without filters:
- RTSP will provide only the first video and only the first audio (any codec)
- MP4 will include only compatible codecs (H264, H265, AAC)
- HLS will output in the legacy TS format (H264 without audio)
Some examples:
rtsp://192.168.1.123:8554/camera1?mp4- useful for recording as MP4 files (e.g. Hass or Frigate)rtsp://192.168.1.123:8554/camera1?video=h264,h265&audio=aac- full version of the filter abovertsp://192.168.1.123:8554/camera1?video=h264&audio=aac&audio=opus- H264 video codec and two separate audio tracksrtsp://192.168.1.123:8554/camera1?video&audio=all- any video codec and all audio codecs as separate trackshttp://192.168.1.123:1984/api/stream.m3u8?src=camera1&mp4- HLS stream with MP4 compatible codecs (HLS/fMP4)http://192.168.1.123:1984/api/stream.m3u8?src=camera1&mp4=flac- HLS stream with PCMA/PCMU/PCM audio support (HLS/fMP4), won't work on old deviceshttp://192.168.1.123:1984/api/stream.mp4?src=camera1&mp4=flac- MP4 file with PCMA/PCMU/PCM audio support, won't work on old devices (ex. iOS 12)http://192.168.1.123:1984/api/stream.mp4?src=camera1&mp4=all- MP4 file with non-standard audio codecs, won't work on some players
AVC/H.264 video can be played almost anywhere. ButHEVC/H.265 has many limitations in supporting different devices and browsers.
| Device | WebRTC | MSE | HTTP* | HLS |
|---|---|---|---|---|
| latency | best | medium | bad | bad |
| Desktop Chrome 136+ Desktop Edge Android Chrome 136+ | H264, H265* PCMU, PCMA OPUS | H264, H265* AAC, FLAC* OPUS | H264, H265* AAC, FLAC* OPUS, MP3 | no |
| Desktop Firefox | H264 PCMU, PCMA OPUS | H264 AAC, FLAC* OPUS | H264 AAC, FLAC* OPUS | no |
| Desktop Safari 14+ iPad Safari 14+ iPhone Safari 17.1+ | H264, H265* PCMU, PCMA OPUS | H264, H265 AAC, FLAC* | no! | H264, H265 AAC, FLAC* |
| iPhone Safari 14+ | H264, H265* PCMU, PCMA OPUS | no! | no! | H264, H265 AAC, FLAC* |
| macOSHass App | no | no | no | H264, H265 AAC, FLAC* |
HTTP*- HTTP Progressive Streaming, not related toprogressive download, because the file has no size and no endWebRTC H265- supported inChrome 136+, supported inSafari 18+MSE iPhone- supported iniOS 17.1+
Audio
- Go2rtc supportautomatic repack
PCMA/PCMU/PCMcodecs toFLACfor MSE/MP4/HLS so they will work almost anywhere - WebRTC audio codecs:
PCMU/8000,PCMA/8000,OPUS/48000/2 OPUSandMP3insideMP4 are part of the standard, but some players do not support them anyway (especially Apple)
Apple devices
- all Apple devices don't support HTTP progressive streaming
- old iPhone firmwares don't support MSE technology because it competes with the HTTP Live Streaming (HLS) technology, invented by Apple
- HLS is the worst technology forlive streaming, it still exists only because of iPhones
Codec names
- H264 = H.264 = AVC (Advanced Video Coding)
- H265 = H.265 = HEVC (High Efficiency Video Coding)
- PCMA = G.711 PCM (A-law) = PCM A-law (
alaw) - PCMU = G.711 PCM (µ-law) = PCM mu-law (
mulaw) - PCM = L16 = PCM signed 16-bit big-endian (
s16be) - AAC = MPEG4-GENERIC
- MP3 = MPEG-1 Audio Layer III or MPEG-2 Audio Layer III
There are no plans to embed complex transcoding algorithms inside go2rtc.FFmpeg source does a great job with this. Includinghardware acceleration support.
But go2rtc has some simple algorithms. They are turned on automatically; you do not need to set them up additionally.
PCM for MSE/MP4/HLS
Go2rtc can packPCMA,PCMU andPCM codecs into an MP4 container so that they work in all browsers and all built-in players on modern devices. Including Apple QuickTime:
PCMA/PCMU => PCM => FLAC => MSE/MP4/HLSResample PCMA/PCMU for WebRTC
By default WebRTC supports onlyPCMA/8000 andPCMU/8000. But go2rtc can automatically resample PCMA and PCMU codecs with a different sample rate. Also, go2rtc can transcodePCM codec toPCMA/8000, so WebRTC can play it:
PCM/xxx => PCMA/8000 => WebRTCPCMA/xxx => PCMA/8000 => WebRTCPCMU/xxx => PCMU/8000 => WebRTCImportant
- FLAC codec not supported in an RTSP stream. If you are using Frigate or Hass for recording MP4 files with PCMA/PCMU/PCM audio, you should set up transcoding to the AAC codec.
- PCMA and PCMU are VERY low-quality codecs. They support only 256! different sounds. Use them only when you have no other options.
For example, you want to watch RTSP-stream fromDahua IPC-K42 camera in your Chrome browser.
- this camera supports two-way audio standardONVIF Profile T
- this camera supports codecsH264, H265 for send video, and you select
H264in camera settings - this camera supports codecsAAC, PCMU, PCMA for sending audio (from mic), and you select
AAC/16000in camera settings - this camera supports codecsAAC, PCMU, PCMA for receiving audio (to speaker), you don't need to select them
- your browser supports codecsH264, VP8, VP9, AV1 for receiving video, you don't need to select them
- your browser supports codecsOPUS, PCMU, PCMA for sending and receiving audio, you don't need to select them
- you can't get camera audio directly, because its audio codecs don't match with your browser codecs
- so you decide to use transcoding via FFmpeg and add this setting to the config YAML file
- you have chosen
OPUS/48000/2codec, because it is higher quality than thePCMU/8000orPCMA/8000
Now you have a stream with two sources -RTSP and FFmpeg:
streams:dahua: -rtsp://admin:password@192.168.1.123/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif -ffmpeg:rtsp://admin:password@192.168.1.123/cam/realmonitor?channel=1&subtype=0#audio=opus
go2rtc automatically matches codecs for your browser and all your stream sources. This is calledmulti-source two-way codec negotiation. And this is one of the main features of this app.
PS. You can selectPCMU orPCMA codec in camera settings and not use transcoding at all. Or you can selectAAC codec for main stream andPCMU codec for second stream and add both RTSP to YAML config, this also will work fine.
- Home Assistant2024.11+ - top open-source smart home project
- Frigate0.12+ - open-source NVR built around real-time AI object detection
- Frigate Lovelace Card - custom card for Home Assistant
- OpenIPC - alternative IP camera firmware from an open community
- wz_mini_hacks - custom firmware for Wyze cameras
- EufyP2PStream - a small project that provides a video/audio stream from Eufy cameras that don't directly support RTSP
- ioBroker.euSec -ioBroker adapter for controlling Eufy security devices
- MMM-go2rtc - MagicMirror² module
- ring-mqtt - Ring-to-MQTT bridge
- lightNVR
Distributions
- Dahua - reference implementation streaming protocols, a lot of settings, high stream quality, multiple streaming clients
- EZVIZ - awful RTSP protocol implementation, many bugs in SDP
- Hikvision - a lot of proprietary streaming technologies
- Reolink - some models have an awful, unusable RTSP implementation and not the best RTMP alternative (I recommend that you contact Reolink support for new firmware), few settings
- Sonoff - very low stream quality, no settings, not the best protocol implementation
- TP-Link - few streaming clients, packet loss?
- Chinese cheap noname cameras, Wyze Cams, Xiaomi cameras with hacks (usually have
/live/ch00_1in RTSP URL) - awful but usable RTSP protocol implementation, low stream quality, few settings, packet loss?
Using apps for low RTSP delay
ffplay -fflags nobuffer -flags low_delay "rtsp://192.168.1.123:8554/camera1"- VLC > Preferences > Input / Codecs > Default Caching Level: Lowest Latency
Snapshots to Telegram
About
Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.


