ffmpeg plugin for Homebridge
- Install ffmpeg on your computer
- Install this plugin using: npm install -g homebridge-camera-ffmpeg
- Edit
config.json
and add the camera. - Run Homebridge
- Add extra camera accessories in Home app. The setup code is the same as homebridge.
{
"platform": "Camera-ffmpeg",
"cameras": [
{
"name": "Camera Name",
"videoConfig": {
"source": "-re -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
}
}
]
}
maxStreams
is the maximum number of streams that will be generated for this camera, default 2maxWidth
is the maximum width reported to HomeKit, default1280
maxHeight
is the maximum height reported to HomeKit, default720
maxFPS
is the maximum frame rate of the stream, default10
maxBitrate
is the maximum bit rate of the stream in kbit/s, default300
vcodec
If you're running on a RPi with the omx version of ffmpeg installed, you can change to the hardware accelerated video codec with this option, defaultlibx264
audio
can be set to true to enable audio streaming from camera. To use audio ffmpeg must be compiled with --enable-libfdk-aac, see https://github.com/KhaosT/homebridge-camera-ffmpeg/wiki, defaultfalse
packetSize
If audio or video is choppy try a smaller value, set to a multiple of 188, default1316
vflip
Flips the stream vertically, defaultfalse
hflip
Flips the stream horizontally, defaultfalse
mapvideo
Select the stream used for video, default0:0
mapaudio
Select the stream used for audio, default0:1
videoFilter
Allows a custom video filter to be passed to FFmpeg via-vf
, defaults toscale=1280:720
additionalCommandline
Allows additional of extra command line options to FFmpeg, for example'-loglevel verbose'
debug
Show the output of ffmpeg in the log, defaultfalse
A somewhat complicated example:
{
"platform": "Camera-ffmpeg",
"cameras": [
{
"name": "Camera Name",
"videoConfig": {
"source": "-re -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
}
}
]
}
videoProcessor
is the video processor used to manage videos. eg: ffmpeg (by default) or avconv or /a/path/to/another/ffmpeg. Need to use the same parameters than ffmpeg.
{
"platform": "Camera-ffmpeg",
"videoProcessor": "avconv",
"cameras": [
...
]
}
{
"platform": "Camera-ffmpeg",
"videoProcessor": "/my/own/compiled/ffmpeg",
"cameras": [
...
]
}
This is an optional feature that will automatically store every snapshot taken to your Google Drive account as a photo. This is very useful if you have motion sensor in the same room as the camera, as it will take a snapshot of whatever caused the motion sensor to trigger, and store the image on Google Drive and create a Picture Notification on your iOS device.
The snapshots are stored in a folder called "Camera Pictures", and are named with camera name, date and time of the image.
To enable this feature, please add a new config option "uploader", and follow the steps below.
- Add the option "uploader" to your config.json i.e.
{
"platform": "Camera-ffmpeg",
"cameras": [
{
"name": "Camera Name",
"uploader": true,
"videoConfig": {
"source": "-re -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,
"vcodec": "h264_omx"
}
}
]
}
If the option is missing, it defaults to false, and does not enable the uploader.
- For the setup of Google Drive, please follow the Google Drive Quickstart for Node.js instructions from here except for these changes.
https://developers.google.com/drive/v3/web/quickstart/nodejs
- In Step 1, download the configuration file into your .homebridge directory, and name it
client_secret.json
- Skip Step 2 and 3
- And in step 4, from the homebridge-camera-ffmpeg directory, run
node quickstart.js
Then just follow steps a to c
We have started collecting tested configurations in the wiki, so please before raising an issue with your configuration, please check the wiki. Also if you have a working configuration that you would like to share, please add it to the wiki.