Skip to content
Normen Hansen edited this page Feb 28, 2018 · 26 revisions

Welcome to the homebridge-camera-ffmpeg wiki!

Hikam S5 + Raspberry Pi2

  • using homebridge-camera-ffmpeg-omx from legotheboss
  • removed "-tune zerolatency" from ffmpeg.js (invalid option for my installation)
  • low res "rtsp://xxx.xxx.xxx.xxx/onvif2" stream works fine w/ moderate cpu load
  • high res "rtsp://xxx.xxx.xxx.xxx/onvif1" stream works w/ cpu load of 150%

Blue Iris

If you have a Blue Iris server, you can add any camera with the following configuration:

	{
  	    "platform": "Camera-IP",
  	    "cameras": [
    	        {
      	            "name": "My First Camera",
      	            "videoConfig": {
      		        "source": "-re -i http://user:password@serverip/h264/camshortname/temp.ts",
        	        "stillImageSource": "-i http://user:password@serverip/image/camshortname?q=75",
      		        "maxStreams": 2,
      		        "maxWidth": 1280,
      		        "maxHeight": 1024,
      		        "maxFPS": 15
      	            }
    	        }
  	    ]
	}
  • user/password - user with camera view permissions in Blue Iris
  • serverip - The IP or hostname of your Blue Iris server
  • camshortname - The short name of the camera in Blue Iris
  • maxWidth/maxHeight - set to the camera native resolution

For example, you could use the following URL if for user:homebridge, password: password, server: bi.example.com, camshortname: driveway http://homebridge:password@bi.example.com/h264/driveway/temp.ts

MotionEyeOS

This config reads images from a remote computer (e.g. Raspberry Pi) running MotionEyeOS with default settings, using an IP of 192.168.2.26. If you use MotionEyeOS' fast network camera feature, then you need to change the stillImageSource to the appropriate URL.

    {
        "platform": "Camera-ffmpeg",
        "cameras": [
            {"name": "MotionEyeOS",
                "videoConfig": {
                    "source": "-re -f mjpeg -i http://192.168.2.26:8081",
                    "stillImageSource": "-f mjpeg -i http://192.168.2.26/picture/1/current/",
                    "maxStreams": 2,
                    "maxWidth": 1280,
                    "maxHeight": 800,
                    "maxFPS": 10
                 }
            }
        ]
    }

Raspberry PI

  • You can use h264_omx as the "vcodec" parameter in the config.json to use the hardware h264 ENcoder (compile ffmpeg with --enable-omx-rpi)
  • You can use -vcodec h264_mmal before the source URL to use the hardware h264 DEcoder, e.g. -vcodec h264_mmal -re -i http://192.168.2.26/mjpg/video.mjpg (compile ffmpeg with --enable-mmal)

A suggested compilation configuration for ffmpeg on RasPi that can also handle the RasPi internal camera stream as well as audio encoding looks as follows:

# install build tools
sudo apt-get install pkg-config autoconf automake libtool

# download and build fdk-aac
git clone https://github.com/mstorsjo/fdk-aac.git
cd fdk-aac
./autogen.sh
./configure --prefix=/usr/local --enable-shared --enable-static
make -j4
sudo make install
sudo ldconfig
cd ..

# download and build ffmpeg
git clone https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg
./configure --prefix=/usr/local --arch=armel --target-os=linux --enable-omx-rpi --enable-nonfree --enable-gpl --enable-libfdk-aac --enable-mmal --enable-decoder=h264 --enable-network --enable-protocol=tcp --enable-demuxer=rtsp
make -j4
sudo make install

Tips & Troubleshooting

  • If you get choppy playback for RTSP / H264 streams try adding -rtsp_transport tcp before your source URL, e.g. -rtsp_transport tcp -re -i rtsp://192.168.2.26/ipcam_h264.sdp