Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, MJPEG, HomeKit
10K+
Ultimate camera streaming application with support RTSP, WebRTC, HomeKit, FFmpeg, RTMP, etc.

Inspired by:
http://localhost:1984/Optionally:
Developers:
Download binary for your OS from latest release:
go2rtc_win64.zip - Windows 64-bitgo2rtc_win32.zip - Windows 32-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_mipsel - Linux MIPS (ex. Xiaomi Gateway 3)go2rtc_mac_amd64.zip - Mac Intel 64-bitgo2rtc_mac_arm64.zip - Mac ARM 64-bitDon't forget to fix the rights chmod +x go2rtc_xxx_xxx on Linux and Mac.
Container alexxit/go2rtc with support amd64, 386, arm64, arm. This container is the same as Home Assistant Add-on, but can be used separately from Home Assistant. Container has preinstalled FFmpeg, Ngrok and Python.
https://github.com/AlexxIT/hassio-addonsWebRTC Camera custom component can be used on any Home Assistant installation, including HassWP 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.
go2rtc.yaml in the current work dirrectoryapi server will start on default 1984 port (TCP)rtsp server will start on default 8554 port (TCP)webrtc will use port 8555 (TCP/UDP) for connectionsffmpeg will use default transcoding optionsConfiguration options and a complete list of settings can be found in the wiki.
Available modules:
go2rtc support different stream source types. You can config one or multiple links of any type as stream source.
Available source types:
RTSP and RTSPS cameras with two way audio supportRTMP streamsHTTP-FLV, MPEG-TS, JPEG (snapshots), MJPEG streamsHLS, files and many others)Read more about incoming sources
Supported for sources:
Two way audio can be used in browser with WebRTC technology. The browser will give access to the microphone only for HTTPS sites (read more).
go2rtc also support play audio files and live streams on this cameras.
streams:
sonoff_camera: rtsp://rtsp:[email protected]/av_stream/ch0
dahua_camera:
- rtsp://admin:[email protected]/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif
- rtsp://admin:[email protected]/cam/realmonitor?channel=1&subtype=1
amcrest_doorbell:
- rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0#backchannel=0
unify_camera: rtspx://192.168.1.123:7441/fD6ouM72bWoFijxK
glichy_camera: ffmpeg:rstp://username:[email protected]/live/ch00_1
Recommendations
#backchannel=0 to the end of your RTSP link in YAML config filertspx:// prefix instead of rtsps://. And don't use ?enableSrtp suffixYou can get stream from RTMP server, for example Frigate.
streams:
rtmp_stream: rtmp://192.168.1.123/live/camera1
Support Content-Type:
video/x-flv) - same as RTMP, but over HTTPimage/jpeg) - camera snapshot link, can be converted by go2rtc to MJPEG streammultipart/x) - simple MJPEG stream over HTTPvideo/mpeg) - legacy streaming formatstreams:
# [HTTP-FLV] stream in video/x-flv format
http_flv: http://192.168.1.123:20880/api/camera/stream/780900131155/657617
# [JPEG] snapshots from Dahua camera, will be converted to MJPEG stream
dahua_snap: http://admin:[email protected]/cgi-bin/snapshot.cgi?channel=1
# [MJPEG] stream will be proxied without modification
http_mjpeg: https://mjpeg.sanford.io/count.mjpeg
PS. Dahua camera has bug: if you select MJPEG codec for RTSP second stream - snapshot won't work.
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}#{param1}#{param2}#{param3}. Examples:
streams:
# [FILE] all tracks will be copied without transcoding codecs
file1: ffmpeg:/media/BigBuckBunny.mp4
# [FILE] video will be transcoded to H264, audio will be skipped
file2: ffmpeg:/media/BigBuckBunny.mp4#video=h264
# [FILE] video will be copied, audio will be transcoded to pcmu
file3: ffmpeg:/media/BigBuckBunny.mp4#video=copy#audio=pcmu
# [HLS] video will be copied, audio will be skipped
hls: ffmpeg:https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/gear5/prog_index.m3u8#video=copy
# [MJPEG] video will be transcoded to H264
mjpeg: ffmpeg:http://185.97.122.128/cgi-bin/faststream.jpg#video=h264
# [RTSP] video with rotation, should be transcoded, so select H264
rotate: ffmpeg:rtsp://rtsp:[email protected]/av_stream/ch0#video=h264#rotate=90
All trascoding formats has built-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 config and use them with source params.
ffmpeg:
bin: ffmpeg # path to ffmpeg binary
h264: "-codec:v libx264 -g:v 30 -preset:v superfast -tune:v zerolatency -profile:v main -level:v 4.1"
mycodec: "-any args that support ffmpeg..."
myinput: "-fflags nobuffer -flags low_delay -timeout 5000000 -i {input}"
video and audio params multiple times (ex. #video=copy#audio=copy#audio=pcmu)ffmpeg:camera1#video=h264)rotate params with 90, 180, 270 or -90 values, important with transcoding (ex. #video=h264#rotate=90)width and/or height params, important with transcoding (ex. #video=h264#width=1280)raw param for any additional FFmpeg arguments (ex. #raw=-vf transpose=1)input param to override default input template (ex. #input=rtsp/udp will change RTSP transport from TCP to UDP+TCP)
#input=-timeout 5000000 -i {input})Read more about encoding hardware acceleration.
You can get video from any USB-camera or Webcam as RTSP or WebRTC stream. This is part of FFmpeg integration.
resolution and framerate must be supported by your camera!streams:
linux_usbcam: ffmpeg:device?video=0&resolution=1280x720#video=h264
windows_webcam: ffmpeg:device?video=0#video=h264
macos_facetime: ffmpeg:device?video=0&audio=1&resolution=1280x720&framerate=30#video=h264#audio=pcma
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:
streams:
stream1: exec:ffmpeg -hide_banner -re -stream_loop -1 -i /media/BigBuckBunny.mp4 -c copy -rtsp_transport tcp -f rtsp {output}
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 the supported sources.
Docker and Hass Add-on users has preinstalled python3, curl, jq.
Check examples in wiki.
streams:
apple_hls: echo:python3 hls.py https://developer.apple.com/streaming/examples/basic-stream-osx-ios5.html
Important:
go2rtc support import paired HomeKit devices from Home Assistant. So you can use HomeKit camera with Hass and go2rtc simultaneously. If you 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 reboot your HomeKit device (power off). If you still can't see it - you have a problems with mDNS.
If you see a device but it does not have a pair button - it is paired to some ecosystem (Apple Home, Home Assistant, HomeBridge etc). You need to delete device from that ecosystem, and it will be available for pairing. If you cannot unpair device, you will have to reset it.
Important:
#async optionffplay with -use_wallclock_as_timestamps 1 -async 1 optionsVLC and probably any other playerRecommended settings for using HomeKit Camera with WebRTC, MSE, MP4, RTSP:
streams:
aqara_g3:
- hass:Camera-Hub-G3-AB12
- ffmpeg:aqara_g3#audio=aac#audio=opus#async
RTSP 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 with Aqara Camera Hub G3 (both EU and CN versions).
Other names: DVR-IP, NetSurveillance, Sofia protocol (NETsurveillance ActiveX plugin XMeye SDK).
username, password, port, channel and subtype if they are defaultsubtype=0 for Main stream, and subtype=1 for Extra1 streamstreams:
camera1: dvrip://username:[email protected]:34567?channel=0&subtype=0
TP-Link Tapo proprietary camera protocol with two way audio support.
admin usernamestreams:
# cloud password without username
camera1: tapo://[email protected]
# admin username and UPPERCASE MD5 cloud-password hash
camera2: tapo://admin:[email protected]
Support public cameras from service Ivideon.
streams:
quailcam: ivideon:100-tu5dkUPct39cTp9oNEN2B6/0
Support import camera links from Home Assistant config files:
hass:
config: "/config" # skip this setting if you Hass Add-on user
streams:
generic_camera: hass:Camera1 # Settings > Integrations > Integration Name
aqara_g3: hass:Camera-Hub-G3-AB12
More cameras, like Tuya, ONVIF, and possibly others can also be imported by using this method.
This source type support only backchannel audio for Hikvision ISAPI protocol. So it should be used as second source in addition to the RTSP protocol.
streams:
hikvision1:
- rtsp://admin:[email protected]:554/Streaming/Channels/101
- isapi://admin:[email protected]:80/
This source type support Roborock vacuums with cameras. Known working models:
Source support load Roborock credentials from Home Assistant custom integration. Otherwise, you need to log in to your Roborock account (MiHome account is not supported). Go to: go2rtc WebUI > Add webpage. Copy roborock://... source for your vacuum and paste it to go2rtc.yaml config.
If you have graphic pin for your vacuum - add it as numeric pin (lines: 123, 456, 678) to the end of the roborock-link.
This source type support two connection formats:
go2rtc/WebSocket - This format is only supported in go2rtc. Unlike WHEP it supports asynchronous WebRTC connection and two way audio.streams:
webrtc1: webrtc:http://192.168.1.123:1984/api/webrtc?src=dahua1
webrtc2: webrtc:ws://192.168.1.123:1984/api/ws?src=dahua1
This source can get a stream from another go2rtc via WebTorrent 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.
Examples
ffmpeg -re -i BigBuckBunny.mp4 -c copy -rtsp_transport tcp -f rtsp rtsp://localhost:8554/camera1
ffmpeg -re -i BigBuckBunny.mp4 -c mjpeg -f mpjpeg http://localhost:1984/api/stream.mjpeg?dst=camera1
ffmpeg -re -i BigBuckBunny.mp4 -c copy -f flv http://localhost:1984/api/stream.flv?dst=camera1
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 video and two way audio. Or even broadcast your PC screen:
go2rtc.yamllinks page for you streamcamera+microphone or display+speaker optionwebrtc local page (your go2rtc should work over HTTPS!) or share link via WebTorrent technology (work over HTTPS by default)You can use OBS Studio or any other broadcast software with WHIP protocol support. This standard has not yet been approved. But you can download OBS Studio dev version:
go2rtc support play audio files (ex. music or TTS) and live streams (ex. radio) on cameras with two 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
Content type
Image
Digest
sha256:96aedd514…
Size
101.2 MB
Last updated
about 2 years ago
docker pull skrashevich/go2rtc