reostream

module
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: AGPL-3.0

README

reostream

Pulls video from Reolink cameras over their native Baichuan protocol and serves it as RTSP and HTTP MPEG-TS. Built for Frigate; works with anything that plays a URL.

camera --Baichuan(9000)--> reostream --RTSP--> go2rtc / Frigate / Blue Iris
                                     --HTTP--> mpv / VLC / scripts

Why

Reolink's RTSP server is broken on some models. On a Duo 3 it gave green blocks, grey frames and smearing. Same camera, same encoder, same thirty minutes, both transports:

transport segments segments with bitstream errors
Baichuan 184 0
RTSP 178 147

Reolink's own NVR looks fine because it uses Baichuan, not RTSP. A fisheye here also loses about 21% of its frames over RTSP. Method in docs/measurements.md.

Neolink did this first and made the protocol understandable. It has had no commits since January 2025. reostream is a new implementation, not a fork.

Quickstart

docker run -d --name reostream --restart unless-stopped \
  -v reostream-data:/data \
  -p 8560:8560 -p 8561:8561 -p 8562:8562 \
  ghcr.io/volttech21/reostream:latest

docker logs reostream
  1. The log prints a one-time token. Open http://<host>:8562/claim and paste it.
  2. Keep the password it gives you.
  3. Add a camera: its IP, admin, and its password. Port 9000 on the camera must be reachable; it is on by default.

Your streams are at rtsp://<host>:8561/<camera> and http://<host>:8560/<camera>.ts.

Prefer compose, a plain binary or systemd? See docs/setup.md.

Using it with Frigate

Feed go2rtc from reostream's RTSP, and point Frigate at go2rtc. One camera connection then serves detect, record and live view.

go2rtc:
  streams:
    driveway:
      - rtsp://reostream:8561/driveway
      - ffmpeg:driveway#audio=opus
    driveway_sub:
      - rtsp://reostream:8561/driveway_sub

cameras:
  driveway:
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/driveway_sub
          input_args: preset-rtsp-restream
          roles: [detect]
        - path: rtsp://127.0.0.1:8554/driveway
          input_args: preset-rtsp-restream
          roles: [record, audio]

The #audio=opus line is optional; it gives browsers and apps audio in live view.

Without go2rtc, Frigate can read http://reostream:8560/driveway.ts directly.

Endpoints

RTSP, port 8561 HTTP, port 8560
/<cam> /<cam>.ts main stream
/<cam>_sub /<cam>_sub.ts sub stream
/<cam>_extern /<cam>_extern.ts extern: the middle stream (about 896x512 H.264) most clients never offer

Also on port 8560:

/<cam>.keyframe latest keyframe, raw
/<cam>.frames raw access units with a small header, for your own decoder; see docs/setup.md
/api/status per-stream JSON: connected, fps, bitrate, clients, reconnects, last error
/metrics the same for Prometheus

What it does

  • One connection per stream, held open whether anyone is watching or not.
  • Timestamps from the camera's own clock, so frame rates come out right.
  • A slow client is disconnected, never buffered. No client can stall a camera.
  • New clients start at a keyframe. Audio is carried when the camera sends it.
  • Sessions are closed cleanly. A camera left with an open session refuses connections for minutes.
  • A web page on port 8562 for status, live view, config, logs and camera settings.

No ffmpeg, GStreamer or RTSP server in the serving path.

Tested on

Model Count Firmware
RLC-810A (8 MP bullet) 6 v3.1.0.956_24022103
FE-P (fisheye) 1 v3.0.0.5336_2509021915
Duo 3 PoE (dual lens panorama) 1 v3.0.0.5049_2506302188

reostream has been the only video path for this fleet's Frigate since September: 23 streams, 69 Mbps, about 60% of one CPU core, 29-59 MB of memory. Numbers in docs/measurements.md.

Not yet tested:

  • Battery cameras. They sleep and wake, and the protocol client has not seen them yet. Reports welcome.
  • Other models and firmware.

Camera control

reocam reads and changes camera settings over the same protocol. Streaming does not need it.

reocam -address 192.0.2.50 -password secret probe

probe reports which messages the camera answers. See docs/control.md for reading and writing settings and what to watch out for.

More

  • docs/setup.md: other ways to run it, the config file, the control page, RTSP, the frames feed
  • docs/control.md: camera control with reocam
  • docs/protocol.md: what the Baichuan wire actually does
  • docs/measurements.md: how every number above was measured

License

AGPL v3. Free to use, run and modify. If you distribute a modified version or run one as a service for others, you must publish your changes.

A commercial license without that obligation is available. See COPYRIGHT.

Directories

Path Synopsis
cmd
bcpcap command
Command bcpcap decodes a Baichuan conversation out of a packet capture.
Command bcpcap decodes a Baichuan conversation out of a packet capture.
bcprobe command
Command bcprobe connects to one camera and writes its video elementary stream to stdout.
Command bcprobe connects to one camera and writes its video elementary stream to stdout.
reocam command
Command reocam controls a camera over Baichuan.
Command reocam controls a camera over Baichuan.
reostream command
Command reostream serves Reolink camera video as MPEG-TS over HTTP for every camera listed in a config file, reconnecting failed streams with backoff and never running two connections to the same stream at once.
Command reostream serves Reolink camera video as MPEG-TS over HTTP for every camera listed in a config file, reconnecting failed streams with backoff and never running two connections to the same stream at once.
talkstop command
internal
adpcm
Package adpcm encodes 16 bit mono PCM as IMA ADPCM, the "DVI4" variant the Reolink cameras accept for two-way audio.
Package adpcm encodes 16 bit mono PCM as IMA ADPCM, the "DVI4" variant the Reolink cameras accept for two-way audio.
baichuan
Package baichuan implements the Reolink Baichuan protocol.
Package baichuan implements the Reolink Baichuan protocol.
cgi
Package cgi talks to a Reolink camera's HTTP API.
Package cgi talks to a Reolink camera's HTTP API.
config
Package config loads the TOML file that lists the cameras reostream serves.
Package config loads the TOML file that lists the cameras reostream serves.
control
Accounts: read only, on purpose, with no exception carved out anywhere in this file.
Accounts: read only, on purpose, with no exception carved out anywhere in this file.
fakecam
Package fakecam fakes a Baichuan camera for tests, without a socket library of its own and without any protocol logic.
Package fakecam fakes a Baichuan camera for tests, without a socket library of its own and without any protocol logic.
frames
Package frames serves a stream's access units over HTTP as length-prefixed records, for low-latency clients that feed a hardware decoder directly.
Package frames serves a stream's access units over HTTP as length-prefixed records, for low-latency clients that feed a hardware decoder directly.
hub
Package hub broadcasts MPEG-TS chunks from one camera goroutine to any number of HTTP clients.
Package hub broadcasts MPEG-TS chunks from one camera goroutine to any number of HTTP clients.
rtsp
Package rtsp serves camera streams over RTSP.
Package rtsp serves camera streams over RTSP.
server
Package server exposes hub streams as MPEG-TS over HTTP.
Package server exposes hub streams as MPEG-TS over HTTP.
stream
Package stream joins one camera to one hub: dial, depacketise, mux, publish, on repeat until the context is cancelled or something fails.
Package stream joins one camera to one hub: dial, depacketise, mux, publish, on repeat until the context is cancelled or something fails.
supervisor
Package supervisor keeps every configured camera stream running, one goroutine per stream, restarting it with backoff when it fails.
Package supervisor keeps every configured camera stream running, one goroutine per stream, restarting it with backoff when it fails.
ts
Package ts muxes decoded camera frames into an MPEG-TS byte stream.
Package ts muxes decoded camera frames into an MPEG-TS byte stream.
webui
Package webui is the session, auth and rendering plumbing behind the reostream daemon's operator page -- one process, one page, covering both the fleet and the cameras on it.
Package webui is the session, auth and rendering plumbing behind the reostream daemon's operator page -- one process, one page, covering both the fleet and the cameras on it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL