Skip to content

Commit 9f7a6bd

Browse files
authored
Beginning the transition to the new ffmpeg build
Changing links, updating my examples, etc.
1 parent 681153a commit 9f7a6bd

File tree

1 file changed

+27
-59
lines changed
  • content/wiki/service/camera-control

1 file changed

+27
-59
lines changed

content/wiki/service/camera-control/index.md

Lines changed: 27 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: "Camera Control"
33
description: "Camera Control"
44
lead: ""
55
date: 2021-04-17T18:50:12.026Z
6-
lastmod: 2021-10-09T12:01:54.995Z
6+
lastmod: 2022-02-18T22:06:22.437Z
77
draft: false
88
images: []
99
menu:
@@ -17,28 +17,32 @@ contributors: ["caitken-com", "crxporter", "itsj4y", "Shaquu"]
1717

1818
## Notes on Cameras
1919

20-
Cameras are a complicated situation. If you are running the [Docker way](https://github.com/NRCHKB/node-red-contrib-homekit-docker) then FFMPEG will be preinstalled for you with several of the options preset (may not have all hardware accelerations built). Alternately you can download and compile your own version of FFMPEG with the build flags you need for your cameras.
20+
Cameras are a complicated situation. If you are running the [Docker way](https://github.com/NRCHKB/node-red-contrib-homekit-docker) then FFmpeg will be preinstalled for you with several of the options preset (may not have all hardware accelerations built). If you are on a system with `apt` (Raspberry pi, Ubuntu, Debian, etc) you can use the FFmpeg install script which is maintained by a couple of our users and designed for nrchkb users. This script is documented [here](https://github.com/marcus-j-davies/nrchkb-ffmpeg-build) and can be run at any time using this one-line terminal command then following the prompts:
2121

22-
For those writing examples, please include how you have installed FFMPEG!
22+
```
23+
bash <(curl -sL https://raw.githubusercontent.com/marcus-j-davies/nrchkb-ffmpeg-build/main/nrchkb-ffmpeg-build.sh)
24+
```
25+
26+
For those writing examples, please include how you have installed FFmpeg (including any special build flags)!
2327

24-
It is recommended to add only one camera per bridge. The camera should be the "parent" service with "motion" and "doorbell" (if used) as linked services.
28+
It is recommended use "Accessory" as the Host Type for cameras. The camera should be the "parent" service with "motion" and "doorbell" (if used) as linked services.
2529

2630
### How to debug issues
2731

28-
If you have problems with FFMPEG (if you think the camera is set up properly but it "does nothing" then you might have FFMPEG problems) then please follow these steps to properly debug your FFMPEG setup.
32+
If you have problems with FFmpeg (if you think the camera is set up properly but it "does nothing" then you might have FFmpeg problems) then please follow these steps to properly debug your FFmpeg setup.
2933

3034
- Configure Camera Control node in Node-RED
3135
- Run Node-RED with `DEBUG=NRCHKB*,CameraSource*` and tick "debug mode" in Camera Control
3236
- ![Camera Control Debug checkbox](camera-control-debug.png)
3337
- Try to open Camera stream in Home.app
34-
- It will error again but will also print FFMPEG command in logs
38+
- It will error again but will also print FFmpeg command in logs
3539
- Run that command in terminal separately to get real problem
3640

3741
## Examples
3842

3943
### * Raspberry Pi Zero W
4044

41-
Example written by CRXPorter. Date 21 November 2020. Plugin version 1.2.0, Node-RED version 1.2.5.
45+
Example written by CRXPorter. Date 21 November 2020, updated February, 2022. Plugin version 1.4.3, Node-RED version 2.1.5.
4246

4347
Hardware:\
4448
-Raspberry Pi Zero W\
@@ -50,7 +54,11 @@ Step **zero**: I assume you are able to set up a pi zero with SSH and Wi-Fi. I a
5054

5155
Step **one**: use `raspi-config` to enable the camera interface on the pi
5256

53-
Step **two**: install FFMPEG for HomeBridge using the script [found here](https://github.com/homebridge/ffmpeg-for-homebridge)
57+
Step **two**: install FFmpeg for HomeBridge using our script:
58+
59+
```
60+
bash <(curl -sL https://raw.githubusercontent.com/marcus-j-davies/nrchkb-ffmpeg-build/main/nrchkb-ffmpeg-build.sh)
61+
```
5462

5563
Step **three**: install and start Node-RED with the script [found here](https://Node-RED.org/docs/getting-started/raspberrypi)
5664

@@ -59,11 +67,9 @@ Step **four**: install node-red-contrib-homekit-bridged from palette manager
5967
Step **five**: import this flow. It should be a single homekit node
6068

6169
```json
62-
[{"id":"36df1f80.39e34","type":"homekit-service","z":"c9e35eda.bb75f8","isParent":true,"bridge":"f18ad79f.5081e8","parentService":"","name":"Pi zero camera","serviceName":"CameraControl","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.2.0","serialNo":"Default Serial Number","firmwareRev":"1.2.0","hardwareRev":"1.2.0","softwareRev":"1.2.0","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"-re -r 6 -s 1280x720 -f video4linux2 -i /dev/video0","cameraConfigStillImageSource":"-s 1280x720 -f video4linux2 -i /dev/video0","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":"1280","cameraConfigMaxHeight":"720","cameraConfigMaxFPS":"6","cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"h264_omx","cameraConfigAudioCodec":"h264_omx","cameraConfigAudio":false,"cameraConfigPacketSize":"564","cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","waitForSetupMsg":false,"outputs":3,"x":430,"y":260,"wires":[[],[],[]]},{"id":"f18ad79f.5081e8","type":"homekit-bridge","bridgeName":"Camera","pinCode":"111-11-111","port":"","allowInsecureRequest":false,"manufacturer":"Raspberry Pi","model":"Pi zero w","serialNo":"00001","firmwareRev":"1.2.0","hardwareRev":"1.2.0","softwareRev":"1.2.0","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true}]
70+
[{"id":"36df1f80.39e34","type":"homekit-service","z":"c9e35eda.bb75f8","isParent":true,"bridge":"f18ad79f.5081e8","parentService":"","name":"Pi zero camera","serviceName":"CameraControl","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.2.0","serialNo":"Default Serial Number","firmwareRev":"1.2.0","hardwareRev":"1.2.0","softwareRev":"1.2.0","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"-re -r 6 -s 1280x720 -f video4linux2 -i /dev/video0","cameraConfigStillImageSource":"-s 1280x720 -f video4linux2 -i /dev/video0","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":"1280","cameraConfigMaxHeight":"720","cameraConfigMaxFPS":"6","cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"h264_v4l2m2m","cameraConfigAudioCodec":"h264_v4l2m2m","cameraConfigAudio":false,"cameraConfigPacketSize":"564","cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","waitForSetupMsg":false,"outputs":3,"x":430,"y":260,"wires":[[],[],[]]},{"id":"f18ad79f.5081e8","type":"homekit-bridge","bridgeName":"Camera","pinCode":"111-11-111","port":"","allowInsecureRequest":false,"manufacturer":"Raspberry Pi","model":"Pi zero w","serialNo":"00001","firmwareRev":"1.2.0","hardwareRev":"1.2.0","softwareRev":"1.2.0","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true}]
6371
```
6472

65-
(Note to self: need to add this to the examples for next release)
66-
6773
Step **six**: add it to your Home.app and enjoy!
6874

6975
Notes:\
@@ -90,54 +96,16 @@ Cameras tested:
9096
- Unifi G3 Bullet
9197
- Unifi G4 Doorbell
9298

93-
Motion detection and doorbell presses are available for advanced users, ask @crxporter on discord. A new Unifi node is pending from CRXPorter - hopefully coming late 2020.
94-
95-
FFMPEG was installed on a pi 4. Node-RED was installed with the official Node-RED on pi install script.
96-
97-
#### FFMPEG Install
99+
Motion detection and doorbell presses are available for advanced users, ask @crxporter on discord. A new Unifi node is in active development, check [here](https://github.com/NRCHKB/node-red-contrib-unifi-os) for that project.
98100

99-
Install build tools
101+
FFmpeg was installed on a pi 4. Node-RED was installed with the official Node-RED on pi install script.
100102

101-
```bash
102-
sudo apt install git pkg-config autoconf automake libtool libx264-dev
103-
```
104-
105-
ALSA runtime library
103+
#### FFmpeg Install
106104

107-
```bash
108-
sudo apt install libasound2-dev
109-
```
105+
Just run the `nrchkb-ffmpeg-build` script found here:
110106

111-
Download and build fdk-aac
112-
113-
```bash
114-
cd ~
115-
git clone https://github.com/mstorsjo/fdk-aac.git
116-
cd fdk-aac
117-
sudo ./autogen.sh
118-
sudo ./configure --prefix=/usr/local --enable-shared --enable-static
119-
sudo make -j4
120-
sudo make install
121-
sudo ldconfig
122107
```
123-
124-
Download and build ffmpeg
125-
126-
```bash
127-
cd ~
128-
git clone https://github.com/FFmpeg/FFmpeg.git
129-
cd FFmpeg
130-
sudo ./configure --prefix=/usr/local --arch=armel --target-os=linux --enable-omx-rpi --enable-nonfree --enable-gpl --enable-libfdk-aac --enable-mmal --enable-libx264 --enable-decoder=h264 --enable-network --enable-protocol=tcp --enable-demuxer=rtsp
131-
sudo make -j4
132-
sudo make install
133-
```
134-
135-
Clean up
136-
137-
```bash
138-
cd ~
139-
rm -rf FFmpeg
140-
rm -rf fdk-aac
108+
bash <(curl -sL https://raw.githubusercontent.com/marcus-j-davies/nrchkb-ffmpeg-build/main/nrchkb-ffmpeg-build.sh)
141109
```
142110

143111
#### Cameras Setup
@@ -153,17 +121,17 @@ Max Width: 960
153121
Max Height: 720
154122
Max FPS: 10
155123
Max Bitrate: 3072
156-
Video Codec: h264_omx
124+
Video Codec: copy
157125
Audio Codec: libfdk_aac
158126
Audio: yes
159127
Packet Sixe: 564
160-
Map Video: 0:1
161-
Map Audio: 0:0
162-
Video Filter: scale=960:720
128+
Map Video: 0:v
129+
Map Audio: 0:a
130+
Video Filter:
163131
Additional Command Line: -preset slow -profile:v high -level 4.2 -x264-params intra-refresh=1:bframes=0
164132
```
165133
166-
This is a work in progress. Written October 9, 2020. Please find me (crxporter) on [our discord server](https://discord.gg/uvYac5u) if you're having problems or would like more information.
134+
This is a work in progress. Updated 18 February 2022. Please find me (crxporter) on [our discord server](https://discord.gg/uvYac5u) if you're having problems or would like more information.
167135
168136
### * Reolink
169137

0 commit comments

Comments
 (0)