Low Latency HomeKit Camera Support: Homebridge FFmpeg Plugin with Custom Codec Configuration

Stream passthrough method for low latency HomeKit camera support:

  • Device: EZVIZ (萤石) CS-C6CN-3H2CWF (星光夜视版)
  • Low latency (as low as 100ms) from the camera to homebridge-camera-ffmpeg
  • Low CPU load since all streams are passthrough from FFmpeg without re-encoding
  • No audio support due to compatibility issue from the source stream

The configuration should be look like:

"videoConfig": {
    "source": "-rtsp_transport tcp -i rtsp://admin:<device_passcode>@<device_ip>:554/h265/ch1/main/av_stream",
    "maxFPS": 30,
    "audio": false,
    "vcodec": "copy",
}

Here’s the tricky part: the EZVIZ CS-C6CN-3H2CWF will output h265 by default, which is not supported by HAP. And the default bitrate is also too high to handle for iOS devices. So you will need to update some settings for the camera:

  • Download the Chinese version of EZVIZ Studio from the official website (direct link).
  • Install and run
  • Click 本地设备 (Local Devices) on the sidebar
  • Right-click the camera you want to modify, then choose 高级设置 (Advanced Settings)
  • In the popup window, click 图像 (Images) – 视音频 (Audio/Video) on the sidebar, change the following settings:
    • 编码类型 (Encoding Type): STD_H264
    • 码率上限 (Bitrate Limit): 1024 Kbps
    • (Optional) 分辨率 (Resolution): HD720P
  • Click 保存 (Save) to save the settings

Please note this step will slightly reduce the quality of your video stream when you view the stream in EZVIZ official app, but it’s mandatory for the camera to work with HomeKit.

Bonus: audio support without compiling FFmpeg after version 1.0.0:

"videoConfig": {
    "source": "-rtsp_transport tcp -i rtsp://admin:<device_passcode>@<device_ip>:554/h265/ch1/main/av_stream",
    "maxFPS": 30,
    "audio": true
}

This will make FFmpeg re-encode your stream and hurt your CPU. The latency is about 0.6-1 second. I suggest you install Homebridge on a Mac mini for better performance.

Update for homebridge-camera-ffmpeg 3.0.0 and later: It’s finally stable enough to stream passthough with audio support. You can now use the following config:

"videoConfig": {
    "source": "-rtsp_transport tcp -i rtsp://admin:<device_passcode>@<device_ip>:554/h265/ch1/main/av_stream",
    "maxFPS": 30,
    "audio": true,
    "vcodec": "copy",
}