Skip to content
master
Go to file
Code

README.md

Homebridge Camera FFmpeg

npm npm verified-by-homebridge

Homebridge Plugin Providing FFmpeg-based Camera Support

Installation

Before installing this plugin, you should install Homebridge using the official instructions.

Install via Homebridge Config UI X

  1. Search for Camera FFmpeg on the Plugins tab of Config UI X.
  2. Install the Homebridge Camera FFmpeg plugin and use the form to enter your camera configurations.

Manual Installation

  1. Install this plugin using: sudo npm install -g homebridge-camera-ffmpeg --unsafe-perm.
  2. Edit config.json manually to add your cameras. See below for instructions on that.

Tested configurations

Other users have been sharing configurations that work for them on our GitHub site. You may want to check that to see if anyone else has gotten your model of camera working already, or share a configuration setup that works for you.

Manual Configuration

Most Important Parameters

  • platform: (Required) Must always be set to Camera-ffmpeg.
  • name: (Required) Set the camera name for display in the Home app.
  • source: (Required) FFmpeg options on where to find and how to decode your camera's video stream. The most basic form is -i followed by your camera's URL.
  • stillImageSource: If your camera also provides a URL for a still image, that can be defined here with the same syntax as source. If not set, the plugin will grab one frame from source.

Config Example

{
  "platform": "Camera-ffmpeg",
  "cameras": [
    {
      "name": "Camera Name",
      "videoConfig": {
        "source": "-i rtsp://username:password@example.com:554",
        "stillImageSource": "-i http://example.com/still_image.jpg",
        "maxStreams": 2,
        "maxWidth": 1280,
        "maxHeight": 720,
        "maxFPS": 30
      }
    }
  ]
}

Optional Parameters

  • motion: Exposes the motion sensor for this camera. This can be triggered with dummy switches, MQTT messages, or via HTTP, depending on what features are enabled in the config. (Default: false)
  • doorbell: Exposes the doorbell device for this camera. This can be triggered with dummy switches, MQTT messages, or via HTTP, depending on what features are enabled in the config. (Default: false)
  • switches: Enables dummy switches to trigger motion and/or doorbell, if either of those are enabled. When enabled there will be an additional switch that triggers the motion or doorbell event. See the project site for more detailed instructions. (Default: false)
  • motionTimeout: The number of seconds after triggering to reset the motion sensor. Set to 0 to disable resetting of motion trigger for MQTT or HTTP. (Default: 1)
  • manufacturer: Set the manufacturer name for display in the Home app. (Default: Homebridge)
  • model: Set the model for display in the Home app. (Default: Camera FFmpeg)
  • serialNumber: Set the serial number for display in the Home app. (Default: SerialNumber)
  • firmwareRevision: Set the firmware revision for display in the Home app. (Default: current plugin version)
  • unbridge: Bridged cameras can cause slowdowns of the entire Homebridge instance. If unbridged, the camera will need to be added to HomeKit manually. (Default: false)

Config Example with Manufacturer and Model Set

{
  "platform": "Camera-ffmpeg",
  "cameras": [
    {
      "name": "Camera Name",
      "manufacturer": "ACME, Inc.",
      "model": "ABC-123",
      "serialNumber": "1234567890",
      "firmwareRevision": "1.0",
      "videoConfig": {
        "source": "-i rtsp://username:password@example.com:554",
        "stillImageSource": "-i http://example.com/still_image.jpg",
        "maxStreams": 2,
        "maxWidth": 1280,
        "maxHeight": 720,
        "maxFPS": 30
      }
    }
  ]
}

Optional videoConfig Parameters

  • returnAudioTarget: (EXPERIMENTAL - WIP) The FFmpeg output command for directing audio back to a two-way capable camera. This feature is still in development and a configuration that works today may not work in the future.
  • maxStreams: The maximum number of streams that will be allowed at once to this camera. (Default: 2)
  • maxWidth: The maximum width used for video streamed to HomeKit. If set to 0, the resolution of the source is used. If not set, will use any size HomeKit requests.
  • maxHeight: The maximum height used for video streamed to HomeKit. If set to 0, the resolution of the source is used. If not set, will use any size HomeKit requests.
  • maxFPS: The maximum frame rate used for video streamed to HomeKit. If set to 0, the framerate of the source is used. If not set, will use any frame rate HomeKit requests.
  • maxBitrate: The maximum bitrate used for video streamed to HomeKit, in kbit/s. If not set, will use any bitrate HomeKit requests.
  • forceMax: If set, the settings requested by HomeKit will be overridden with any 'maximum' values defined in this config. (Default: false)
  • vcodec: Set the codec used for encoding video sent to HomeKit, must be H.264-based. You can change to a hardware accelerated video codec with this option, if one is available. (Default: libx264)
  • audio: Enables audio streaming from camera. (Default: false)
  • packetSize: If audio or video is choppy try a smaller value, should be set to a multiple of 188. (Default: 1316)
  • mapvideo: Selects the stream used for video. (Default: FFmpeg automatically selects a video stream)
  • mapaudio: Selects the stream used for audio. (Default: FFmpeg automatically selects an audio stream)
  • videoFilter: Comma-delimited list of additional video filters for FFmpeg to run on the video. If 'none' is included, the default video filters are disabled.
  • encoderOptions: Options to be passed to the video encoder. (Default: -preset ultrafast -tune zerolatency if using libx264)
  • debug: Includes debugging output from the main FFmpeg process in the Homebridge log. (Default: false)
  • debugReturn: Includes debugging output from the FFmpeg used for return audio in the Homebridge log. (Default: false)

More Complicated Example

{
  "platform": "Camera-ffmpeg",
  "cameras": [
    {
      "name": "Camera Name",
      "videoConfig": {
        "source": "-i rtsp://myfancy_rtsp_stream",
        "stillImageSource": "-i http://faster_still_image_grab_url/this_is_optional.jpg",
        "maxStreams": 2,
        "maxWidth": 1280,
        "maxHeight": 720,
        "maxFPS": 30,
        "maxBitrate": 200,
        "vcodec": "h264_omx",
        "audio": false,
        "packetSize": 188,
        "hflip": true,
        "additionalCommandline": "-x264-params intra-refresh=1:bframes=0",
        "debug": true
      }
    }
  ]
}

Automation Parameters

  • mqtt: Defines the hostname or IP of the MQTT broker to connect to for MQTT-based automation. If not set, MQTT support is not started. See the project site for more information on using MQTT.
  • portmqtt: The port of the MQTT broker. (Default: 1883)
  • usermqtt: The username used to connect to your MQTT broker. If not set, no authentication is used.
  • passmqtt: The password used to connect to your MQTT broker. If not set, no authentication is used.
  • topic: The base MQTT topic to subscribe to. (Default: homebridge)
  • porthttp: The port to listen on for HTTP-based automation. If not set, HTTP support is not started. See the project site for more information on using HTTP.
  • localhttp: Only allow HTTP calls from localhost. Useful if using helper plugins that translate to HTTP. (Default: false)

Automation Example

{
  "platform": "Camera-ffmpeg",
  "mqtt": "127.0.0.1",
  "topic": "homebridge",
  "porthttp": "8080",
  "cameras": []
}

Rarely Needed Parameters

  • videoProcessor: Defines which video processor is used to decode and encode videos, must take the same parameters as FFmpeg. Common uses would be avconv or the path to a custom-compiled version of FFmpeg. If not set, will use the included version of FFmpeg, or the version of FFmpeg installed on the system if no included version is available.
  • interfaceName: Selects which network interface to use for video streaming to HomeKit. If you have multiple active network interfaces in your system, you may need to set this. If not set, the first available network interface is used, and a mismatch will cause HomeKit to discard the video stream.

Rare Option Example

{
  "platform": "Camera-ffmpeg",
  "videoProcessor": "/usr/bin/ffmpeg",
  "interfaceName": "eth0",
  "cameras": []
}

Credit

Homebridge Camera FFmpeg is based on code originally written by Khaos Tian.

You can’t perform that action at this time.