Skip to content

About

CATLINK camera stream bridge for downstream RTSP consumers

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

CATLINK Stream Bridge

中文文档

CATLINK Stream Bridge pulls video and audio from CATLINK camera-enabled devices and exposes them as RTSP streams for downstream consumers such as Frigate, go2rtc, or other RTSP clients.

Features

  • Cloud streaming: pulls the stream through CATLINK/EZOpen cloud services.
  • Local streaming: connects directly to the device on the same LAN when the device provides the required local media session.
  • Auto mode: prefers local streaming when eligible and falls back to cloud streaming when local streaming is unavailable.
  • H.265 video and G.711A audio are published through RTSP without video or audio re-encoding.
  • Standard RTSP microphone backchannel for go2rtc/Frigate-compatible clients.
  • Device selection by the device name shown in the CATLINK App. A single device can be selected automatically.
  • Login state is shared with an existing CATLINK integration or session service; the bridge does not perform phone/password login.

Current support and limitations

  • The bridge supports CATLINK Visual C07 / 大白 Pro and VISUAL_F05 / 饭兜. F05 local HD/SD streaming has been tested; F05 two-way audio is not yet verified.
  • Stream behavior has only been tested with CATLINK's mainland China service endpoint. Other CATLINK service regions have not been tested.
  • For the tested C07, local streaming supports at most three simultaneous routes; the fourth local route fails to connect.
  • Some Frigate/go2rtc WebRTC combinations may not keep video playback and microphone uplink working at the same time. When the microphone is enabled, video may remain loading or stop while the audio uplink is negotiated. This is a client negotiation compatibility limitation.
  • Local streaming still uses CATLINK cloud authentication/bootstrap. It is not an offline camera service.
  • A route is published after a complete H.265 configuration and keyframe are received. If the upstream temporarily stops sending media, the RTSP route remains available while the bridge restores the source.

Login state and deployment modes

CATLINK Stream Bridge only consumes an existing CATLINK login session. It does not accept a CATLINK phone/password and does not log in or refresh the CATLINK session itself. This avoids multiple components replacing each other's login state.

There are two supported session sources.

Home Assistant deployment

Install and configure the CATLINK integration in Home Assistant. The bridge reads the existing Home Assistant CATLINK auth file from a read-only mounted directory.

Use:

{
  "accounts": [
    {
      "id": "account-main",
      "sessionFile": "/ha-config/.storage/catlink/auth-*.json"
    }
  ]
}

The pattern must match exactly one auth file. If Home Assistant contains more than one CATLINK account, use the exact auth file path instead.

Separate session-reader deployment

Run the CATLINK session-reader service separately. It reads an existing CATLINK login session and exposes it through its API; it does not log in or refresh the session. The bridge calls that API with an API key.

Use:

{
  "accounts": [
    {
      "id": "account-main",
      "sessionProviderUrl": "http://catlink-session-reader:8090/v1/session",
      "apiKey": "replace-with-session-reader-api-key"
    }
  ]
}

Configuration

The process reads the configuration file from CATLINK_GO_CONFIG_FILE:

CATLINK_GO_CONFIG_FILE=/config/streams.json /catlink-go-bridge

If the environment variable is not set, the first command-line argument is used as the configuration path.

Configuration is read at startup. Restart the bridge after updating the mounted configuration file.

The complete examples are:

Top-level configuration fields:

{
  "listen": ":8554",
  "healthListen": ":8080",
  "openDomain": "https://open.ys7.com",
  "accounts": [],
  "devices": [],
  "routes": []
}

Each route contains:

{
  "name": "camera-ch1-hd",
  "deviceId": "device-main",
  "channel": 1,
  "quality": "hd",
  "source": "auto",
  "path": "/catlink_ch1_hd"
}

For C07, channel 1 is the outer camera and channel 2 is the inner camera. F05 uses channel 1. quality can be hd or sd; source can be cloud, local, or auto. If source is omitted, the existing cloud path is used.

For one device, the bridge can select the device automatically. For multiple devices, add a selector using the device name shown in the CATLINK App:

{
  "id": "device-main",
  "accountId": "account-main",
  "selector": {
    "deviceName": "大白 Pro"
  }
}

F05 feeder configuration

Add the feeder to the existing devices and routes arrays, reusing its account. Use its exact name from the CATLINK App; update deviceName below if the device has been renamed. Do not combine serial and selector.

{
  "devices": [
    {
      "id": "feeder-main",
      "accountId": "account-main",
      "selector": { "deviceName": "饭兜" }
    }
  ],
  "routes": [
    {
      "name": "feeder-hd",
      "deviceId": "feeder-main",
      "channel": 1,
      "quality": "hd",
      "source": "local",
      "path": "/feeder_hd"
    }
  ]
}

F05 video is portrait: the tested HD stream is 1072×1920 and SD is 720×1280. Frigate can probe the detection stream dimensions. If detect.width and detect.height are set explicitly, use the stream's portrait aspect ratio. The Frigate live stream mapping must refer to the configured go2rtc name:

go2rtc:
  streams:
    feeder_main:
      - rtsp://<bridge-host>:8554/feeder_hd
cameras:
  feeder:
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/feeder_main
          input_args: preset-rtsp-restream
          roles: [record, detect, audio]
    live:
      streams:
        HD: feeder_main

Recommended C07 route configuration

The recommended daily configuration is two local HD routes, one for each camera/channel:

{
  "routes": [
    {
      "name": "camera-ch1-hd",
      "deviceId": "device-main",
      "channel": 1,
      "quality": "hd",
      "source": "local",
      "path": "/catlink_ch1_hd"
    },
    {
      "name": "camera-ch2-hd",
      "deviceId": "device-main",
      "channel": 2,
      "quality": "hd",
      "source": "local",
      "path": "/catlink_ch2_hd"
    }
  ]
}

This provides high-definition sources for downstream recording while leaving the CATLINK App's own standard-definition live preview available.

The bridge serves RTSP paths on port 8554 and health information on port 8080 at /healthz. /readyz returns success once the RTSP output service is listening, even when no upstream video is available. The routes count in its response is informational and does not gate readiness.

Docker

The image contains the statically linked Go bridge, built using vendored dependencies. It does not run Node.js, Chromium, FFmpeg, or MediaMTX.

Example using session-reader mode:

docker run -d \
  --name catlink-stream-bridge \
  --restart unless-stopped \
  --network host \
  -v "$PWD/streams.json:/config/streams.json:ro" \
  -e CATLINK_GO_CONFIG_FILE=/config/streams.json \
  ghcr.io/<owner>/catlink-stream-bridge:<tag>

For Home Assistant auth-file mode, mount the CATLINK storage directory:

docker run -d \
  --name catlink-stream-bridge \
  --restart unless-stopped \
  --network host \
  -v "$PWD/streams.session-file.json:/config/streams.json:ro" \
  -v /path/to/home-assistant/.storage/catlink:/ha-config/.storage/catlink:ro \
  -e CATLINK_GO_CONFIG_FILE=/config/streams.json \
  ghcr.io/<owner>/catlink-stream-bridge:<tag>

Use the session-file configuration example in that deployment mode.

Downstream RTSP consumers use paths such as:

rtsp://<bridge-host>:8554/catlink_ch1_hd
rtsp://<bridge-host>:8554/catlink_ch2_hd

Contributions

Maintenance capacity is currently limited, so external contributions and pull requests are not accepted for now. Issue reports are welcome and will be addressed when possible.

License

Project-authored code is released under the MIT License. Vendored dependencies retain their own licenses; see THIRD_PARTY_NOTICES.md.

This is an independent project and is not affiliated with or endorsed by CATLINK or EZOpen.

About

CATLINK camera stream bridge for downstream RTSP consumers

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

Contributors

Languages