
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
Ultimate camera streaming application with support RTSP, WebRTC, HomeKit, FFmpeg, RTMP, etc.
Inspired by:
http://localhost:1984/Optionally:
Developers:
Download ***ary for your OS from https://github.com/AlexxIT/go2rtc/releases/:
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. https://github.com/AlexxIT/XiaomiGateway3)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 https://hub.docker.com/r/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, *** and Python.
https://my.home-assistant.io/badges/supervisor_addon.svg](https://my.home-assistant.io/redirect/supervisor_addon/?addon=a889bffc_go2rtc&repository_url=https%3A%2F%2Fgithub.com%2FAlexxIT%2Fhassio-addons)
https://github.com/AlexxIT/hassio-addonshttps://github.com/AlexxIT/WebRTC custom component can be used on any https://www.home-assistant.io/installation/, including https://github.com/AlexxIT/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 https://github.com/AlexxIT/go2rtc/wiki/Configuration.
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
Two way audio
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 (https://stackoverflow.com/questions/52759992/how-to-access-camera-and-microphone-in-chrome-without-https).
go2rtc also support play audio files and live streams on this cameras.
Source: RTSP
yamlstreams: sonoff_camera: rtsp://rtsp:12345678@192.168.1.123/av_stream/ch0 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 amcrest_doorbell: - rtsp://username:password@192.168.1.123:554/cam/realmonitor?channel=1&subtype=0#backchannel=0 unify_camera: rtspx://192.168.1.123:7441/fD6ouM72bWoFijxK glichy_camera: ffmpeg:rstp://username:password@192.168.1.123/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 https://github.com/AlexxIT/go2rtc/issues/81Source: RTMP
You can get stream from RTMP server, for example Frigate.
yamlstreams: rtmp_stream: rtmp://192.168.1.123/live/camera1
Source: HTTP
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 formatyamlstreams: # [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:password@192.168.1.123/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.
Source: FFmpeg
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:
yamlstreams: # [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:12345678@192.168.1.123/av_stream/ch0#video=h264#rotate=90
All trascoding formats has https://github.com/AlexxIT/go2rtc/blob/master/cmd/ffmpeg/ffmpeg.go: 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.
yamlffmpeg: 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 https://github.com/AlexxIT/go2rtc/wiki/Hardware-acceleration.
Source: FFmpeg Device
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!yamlstreams: 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
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:
yamlstreams: stream1: exec:ffmpeg -hide_banner -re -stream_loop -1 -i /media/BigBuckBunny.mp4 -c copy -rtsp_transport tcp -f rtsp {output}
Source: Echo
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 https://github.com/AlexxIT/go2rtc/wiki/Source-Echo-examples.
yamlstreams: apple_hls: echo:python3 hls.py https://developer.apple.com/streaming/examples/basic-stream-osx-ios5.html
Source: HomeKit
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).
Source: DVRIP
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 streamyamlstreams: camera1: dvrip://username:password@192.168.1.123:34567?channel=0&subtype=0
Source: Tapo
TP-Link Tapo proprietary camera protocol with two way audio support.
admin usernameyamlstreams: # cloud password without username camera1: tapo://cloud-password@192.168.1.123 # admin username and UPPERCASE MD5 cloud-password hash camera2: tapo://admin:MD5-PASSWORD-HASH@192.168.1.123
Source: Ivideon
Support public cameras from service Ivideon.
yamlstreams: quailcam: ivideon:100-tu5dkUPct39cTp9oNEN2B6/0
Source: Hass
Support import camera links from https://www.home-assistant.io/ config files:
yamlhass: 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 https://www.home-assistant.io/integrations/tuya/, https://www.home-assistant.io/integrations/onvif/, and possibly others can also be imported by using https://github.com/felipecrs/hass-expose-camera-stream-source#importing-home-assistant-cameras-to-go2rtc-andor-frigate.
Source: ISAPI
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.
yamlstreams: hikvision1: - rtsp://admin:password@192.168.1.123:554/Streaming/Channels/101 - isapi://admin:password@192.168.1.123:80/
Source: Roborock
This source type support Roborock vacuums with cameras. Known working models:
Source support load Roborock credentials from Home Assistant https://github.com/humbertogontijo/homeassistant-roborock. 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.
Source: WebRTC
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.yamlstreams: webrtc1: webrtc:http://192.168.1.123:1984/api/webrtc?src=dahua1 webrtc2: webrtc:ws://192.168.1.123:1984/api/ws?src=dahua1
Source: WebTorrent
This source can get a stream from another go2rtc via WebTorrent protocol.
yamlstreams: webtorrent1: webtorrent:?share=huofssuxaty00izc&pwd=k3l2j9djeg8v8r7e
Incoming sources
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
yamlffmpeg -re -i BigBuckBunny.mp4 -c copy -rtsp_transport tcp -f rtsp rtsp://localhost:8554/camera1
yamlffmpeg -re -i BigBuckBunny.mp4 -c mjpeg -f mpjpeg http://localhost:1984/api/stream.mjpeg?dst=camera1
yamlffmpeg -re -i BigBuckBunny.mp4 -c copy -f flv http://localhost:1984/api/stream.flv?dst=camera1
yamlffmpeg -re -i BigBuckBunny.mp4 -c copy -f mpegts http://localhost:1984/api/stream.ts?dst=camera1
Incoming: Browser
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)Incoming: WebRTC/WHIP
You can use OBS Studio or any other broadcast software with https://www.ietf.org/archive/id/draft-ietf-wish-whip-01.html protocol support. This standard has not yet been approved. But you can download OBS Studio https://github.com/obsproject/obs-studio/actions/runs/3969201209:
Stream to camera
go2rtc support play audio files (ex. music or https://www.home-assistant.io/integrations/#text-to-speech) 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
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务
以下是 skrashevich/go2rtc 相关的常用 Docker 镜像,适用于 不同场景 等不同场景: