Synology (DSM 6.2.2-24922 Update 4) Homebridge on Docker - FFMPEG and Unifi Cameras
<!-- Please search existing issues to avoid creating duplicates. -->

**Describe Your Problem:**
Love this build of Homebridge for Docker. It's brilliant. I've connected several services easily but like a lot of end users hit a wall when it comes to FFMPEG. 

I installed FFMPEG directly in the Docker container.  I added ```ffmpeg,ffmepg-libs``` to the Container environment variables, as well as the startup.sh using ```apt-get update
apt-get install -y ffmpeg```

<img width="393" alt="Screen Shot 2019-11-15 at 11 26 07 AM" src="https://user-images.githubusercontent.com/7277574/68958785-c3d38a00-079a-11ea-930f-f80751e6ab4b.png">

These are the principle error messages from the log

***Invalid argument and ERROR: FFmepg exited with code1***
```Opening an output file: re.
[NULL @ 0x55b6a7744200] Unable to find a suitable output format for 're'
re: Invalid argument

[11/15/2019, 11:36:00 AM] [Camera-ffmpeg] ERROR: FFmpeg exited with code 1```

***No default whitelist***
```Opening an input file: rtsp://XXX.
[tcp @ 0x55b6a7565400] No default whitelist set```


**Logs:**
```[11/15/2019, 11:35:55 AM] [Camera-ffmpeg] Start streaming video from  Camera with 640x360@132kBit
ffmpeg re -rtsp_transport tcp -i rtsp://XXX/XXX -map 0:1 -vcodec h264_omx -pix_fmt yuv420p -r 20 -f rawvideo -preset slow -profile:v high -level 4.2 -x264-params intra-refresh=1:bframes=0 -b:v 132k -bufsize 132k -maxrate 132k -payload_type 99 -ssrc 8293918 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params mhoVFUlUIaXzFnsX0I68VDktRGUjgk6vyOMGZ25p srtp://XXX
?rtcpportXXX&localrtcpportXXX&pkt_size=188 -map 0:0 -acodec libfdk_aac -profile:a aac_eld -flags +global_header -f null -ar 16k -b:a 24k -bufsize 24k -ac 1 -payload_type 110 -ssrc 10291758 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params tg/2oaLL9DGapaxNKxFuY+onrHNcgYH3t3fjd1f/ srtp://XXX?rtcpport=50290&localrtcpport=50290&pkt_size=188 -loglevel debug
ffmpeg version 3.2.14-1~deb9u1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --prefix=/usr --extra-version='1~deb9u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared

  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Splitting the commandline.
Reading option 're' ... matched as output url.
Reading option '-rtsp_transport' ...
 matched as AVOption 'rtsp_transport' with argument 'tcp'.
Reading option '-i' ... matched as input url with argument 'rtsp://XXX'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:1'.

Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'h264_omx'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value, fraction or abbreviation)) with argument '20'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'rawvideo'.
Reading option '-preset' ...
 matched as AVOption 'preset' with argument 'slow'.
Reading option '-profile:v' ...
 matched as option 'profile' (set profile) with argument 'high'.
Reading option '-level' ...
 matched as AVOption 'level' with argument '4.2'.
Reading option '-x264-params' ...
 matched as AVOption 'x264-params' with argument 'intra-refresh=1:bframes=0'.
Reading option '-b:v' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '132k'.
Reading option '-bufsize' ...
 matched as AVOption 'bufsize' with argument '132k'.

Reading option '-maxrate' ...
 matched as AVOption 'maxrate' with argument '132k'.
Reading option '-payload_type' ...
 matched as AVOption 'payload_type' with argument '99'.
Reading option '-ssrc' ...
 matched as AVOption 'ssrc' with argument '8293918'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'rtp'.
Reading option '-srtp_out_suite' ...
 matched as AVOption 'srtp_out_suite' with argument 'AES_CM_128_HMAC_SHA1_80'.
Reading option '-srtp_out_params' ...
 matched as AVOption 'srtp_out_params' with argument 'mhoVFUlUIaXzFnsX0I68VDktRGUjgk6vyOMGZ25p'.
Reading option 'srtp://XXX?rtcpportXXX&localrtcpportXXX&pkt_size=188' ... matched as output url.
Reading option '-map' ...
 matched as option 'map' (set input stream mapping) with argument '0:0'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'libfdk_aac'.
Reading option '-profile:a' ... matched as option 'profile' (set profile) with argument 'aac_eld'.
Reading option '-flags' ...
 matched as AVOption 'flags' with argument '+global_header'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'null'.
Reading option '-ar' ...
 matched as option 'ar' (set audio sampling rate (in Hz)) with argument '16k'.
Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '24k'.
Reading option '-bufsize' ...
 matched as AVOption 'bufsize' with argument '24k'.
Reading option '-ac' ... matched as option 'ac' (set number of audio channels) with argument '1'.
Reading option '-payload_type' ...
 matched as AVOption 'payload_type' with argument '110'.
Reading option '-ssrc' ...
 matched as AVOption 'ssrc' with argument '10291758'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'rtp'.
Reading option '-srtp_out_suite' ... matched as AVOption 'srtp_out_suite' with argument 'AES_CM_128_HMAC_SHA1_80'.
Reading option '-srtp_out_params' ... matched as AVOption 'srtp_out_params' with argument 'tg/2oaLL9DGapaxNKxFuY+onrHNcgYH3t3fjd1f/'.
Reading option 'srtp://XXX?rtcpport=50290&localrtcpport=50290&pkt_size=188' ... matched as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url rtsp://XXX.
Successfully parsed a group of options.
Opening an input file: rtsp://XXX.
[tcp @ 0x55b6a7565400] No default whitelist set

[rtsp @ 0x55b6a75635c0] SDP:
v=0
o=- 607 0 IN IP4 XXX
s=FCECDA8FE837_1
u=www.evostream.com
e=contact@evostream.com
c=IN IP4 XXX
t=0 0
a=recvonly
a=control:*
a=range:npt=now-
m=audio 0 RTP/AVP 96
a=recvonly
a=rtpmap:96 mpeg4-generic/44100/1
a=control:trackID=1
a=fmtp:96 streamtype=5; profile-level-id=15; mode=AAC-hbr; config=1208; SizeLength=13; IndexLength=3; IndexDeltaLength=3;
m=video 0 RTP/AVP 97
a=recvonly
a=control:trackID=2
a=rtpmap:97 H264/90000
a=fmtp:97 profile-level-id=4d401f; packetization-mode=1; sprop-parameter-sets=Z01AH5pkAgAk/4C3AQEBQAAA+gAAHUwl,aO48gA==


[rtsp @ 0x55b6a75635c0] audio codec set to: aac
[rtsp @ 0x55b6a75635c0] audio samplerate set to: 44100
[rtsp @ 0x55b6a75635c0] audio channels set to: 1
[rtsp @ 0x55b6a75635c0] video codec set to: h264
[rtsp @ 0x55b6a75635c0] RTP Profile IDC: 4d Profile IOP: 40 Level: 1f
[rtsp @ 0x55b6a75635c0] RTP Packetization Mode: 1
[rtsp @ 0x55b6a75635c0] Extradata set to 0x55b6a756a2a0 (size: 36)

[rtsp @ 0x55b6a75635c0] setting jitter buffer size to 0

    Last message repeated 1 times
[rtsp @ 0x55b6a75635c0] hello state=0

[h264 @ 0x55b6a7569e20] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x55b6a7569e20] nal_unit_type: 8, nal_ref_idc: 3

[h264 @ 0x55b6a7569e20] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x55b6a7569e20] nal_unit_type: 8, nal_ref_idc: 3

[h264 @ 0x55b6a7569e20] nal_unit_type: 7, nal_ref_idc: 3

[h264 @ 0x55b6a7569e20] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x55b6a7569e20] nal_unit_type: 1, nal_ref_idc: 3

[h264 @ 0x55b6a7569e20] Reinit context to 1024x576, pix_fmt: yuvj420p
[h264 @ 0x55b6a7569e20] Frame num gap 15 13

[h264 @ 0x55b6a7569e20] nal_unit_type: 1, nal_ref_idc: 3

    Last message repeated 1 times
[h264 @ 0x55b6a7569e20] nal_unit_type: 7, nal_ref_idc: 3

[h264 @ 0x55b6a7569e20] nal_unit_type: 8, nal_ref_idc: 3

[h264 @ 0x55b6a7569e20] nal_unit_type: 5, nal_ref_idc: 3

[h264 @ 0x55b6a7569e20] nal_unit_type: 1, nal_ref_idc: 3

    Last message repeated 5 times
[rtsp @ 0x55b6a75635c0] All info found
[rtsp @ 0x55b6a75635c0] rfps: 14.666667 0.016419

[rtsp @ 0x55b6a75635c0] rfps: 14.750000 0.009235
    Last message repeated 1 times
[rtsp @ 0x55b6a75635c0] rfps: 14.833333 0.004104
    Last message repeated 1 times
[rtsp @ 0x55b6a75635c0] rfps: 14.916667 0.001026
    Last message repeated 1 times
[rtsp @ 0x55b6a75635c0] rfps: 15.000000 0.000000
[rtsp @ 0x55b6a75635c0] rfps: 15.083333 0.001026
    Last message repeated 1 times
[rtsp @ 0x55b6a75635c0] rfps: 15.166667 0.004105
    Last message repeated 1 times
[rtsp @ 0x55b6a75635c0] rfps: 15.250000 0.009237
    Last message repeated 1 times
[rtsp @ 0x55b6a75635c0] rfps: 15.333333 0.016421
[rtsp @ 0x55b6a75635c0] rfps: 29.666667 0.016418
[rtsp @ 0x55b6a75635c0] rfps: 29.750000 0.009235
    Last message repeated 1 times
[rtsp @ 0x55b6a75635c0] rfps: 29.833333 0.004104
    Last message repeated 1 times
[rtsp @ 0x55b6a75635c0] rfps: 29.916667 0.001026
    Last message repeated 1 times
[rtsp @ 0x55b6a75635c0] rfps: 30.000000 0.000000
[rtsp @ 0x55b6a75635c0] rfps: 45.000000 0.000000
[rtsp @ 0x55b6a75635c0] rfps: 60.000000 0.000000
[rtsp @ 0x55b6a75635c0] rfps: 120.000000 0.000000
[rtsp @ 0x55b6a75635c0] rfps: 240.000000 0.000002
[rtsp @ 0x55b6a75635c0] rfps: 29.970030 0.000133
    Last message repeated 1 times
[rtsp @ 0x55b6a75635c0] rfps: 59.940060 0.000530
    Last message repeated 1 times
[rtsp @ 0x55b6a75635c0] rfps: 14.985015 0.000033

    Last message repeated 1 times
Input #0, rtsp, from 'rtsp://XXX':
  Metadata:
    title           : FCECDA8FE837_1
  Duration: N/A, start: 0.000000, bitrate: N/A

    Stream #0:0, 88, 1/44100: Audio: aac (LC), 44100 Hz, mono, fltp
    Stream #0:1, 31, 1/90000: Video: h264 (Main), 1 reference frame, yuvj420p(pc, bt709, progressive, left), 1024x576 [SAR 1:1 DAR 16:9], 0/1, 15 fps, 15 tbr, 90k tbn, 30 tbc
Successfully opened the file.
Parsing a group of options: output url re.
Successfully parsed a group of options.
Opening an output file: re.
[NULL @ 0x55b6a7744200] Unable to find a suitable output format for 're'
re: Invalid argument

[11/15/2019, 11:36:00 AM] [Camera-ffmpeg] ERROR: FFmpeg exited with code 1```

```
Show the Docker container logs here
```

**Docker Start Command:**
Run this directly through UI of Synology Package.

```
docker run --net=host ...

Not sure what this means.

```

**Homebridge Config:**

```{
    "bridge": {
        "name": "Homebridge",
        "username": "0E:C5:BF:22:17:65",
        "port": 52327,
        "pin": "XXX-XX-XXX" ///masked for security purposes
    },
    "accessories": [],
    "platforms": [
        {
            "platform": "DysonPureCoolPlatform",
            "username": "XXXXXX",
            "password": "XXXXXX",
            "countryCode": "US",
            "devices": [
                {
                    "ipAddress": "XXX.XXX.XX.XX",
                    "serialNumber": "XXX-XX-XXXXXXXX",
                    "enableAutoModeWhenActivating": true,
                    "isNightModeEnabled": true,
                    "isJetFocusEnabled": true,
                    "isTemperatureSensorEnabled": false,
                    "isHumiditySensorEnabled": true,
                    "isAirQualitySensorEnabled": true
                }
            ]
        },
        {
            "name": "Camera-ffmpeg",
            "cameras": [
                {
                    "name": "Camera",
                    "manufacturer": "Ubiquiti Networks",
                    "model": "UVC-G3-MICRO",
                    "serialNumber": "XX:XX:XX:XX:XX:XX", ///masked for security purposes
                    "firmwareRevision": "4.14.14",
                    "videoConfig": {
                        "source": "re -rtsp_transport tcp -i rtsp://XXX.XXX.X.X:XXXX/XXXXXXXXXX", ///masked for security purposes
                        "stillImageSource": "-i http://XX.XXX.XX.X/snap.jpg", ///masked for security purposes
                        "maxStreams": 2,
                        "maxWidth": 1024,
                        "maxHeight": 486,
                        "maxFPS": 20,
                        "maxBitrate": 300,
                        "vcodec": "h264_omx",
                        "packetSize": 188,
                        "audio": false,
                        "debug": true,
                        "mapvideo": "0:1",
                        "mapaudio": "0:0"
                    }
                }
            ],
            "platform": "Camera-ffmpeg"
        }
    ]
}
```

**Screenshots:**

Error Screenshots

<img width="1268" alt="Screen Shot 2019-11-15 at 11 36 46 AM" src="https://user-images.githubusercontent.com/7277574/68959565-44df5100-079c-11ea-9982-90d57c187c51.png">


**Environment:**

* **Host Operating System**: Debian
* **Docker Version**: Version: 18.09.0-0506
* **Image Tag / Type**: [Docker oznu/homebridge:debian](https://hub.docker.com/r/oznu/homebridge/)

 I am running the following Environment:

[Synology DS918+](https://www.synology.com/en-us/products/DS918+)
[DSM Version DSM 6.2.2-24922 Update 4](https://community.synology.com/enu/forum/1/post/129616)
[Homebridge Version Version 0.4.50](https://github.com/oznu/docker-homebridge/wiki/Homebridge-on-Synology)
[Docker oznu/homebridge:debian](https://hub.docker.com/r/oznu/homebridge/)

Homebridge was installed via the SPK package [homebridge-syno-spk](https://github.com/oznu/homebridge-syno-spk)

This is the version of FFMPEG

```ffmpeg version 3.2.14-1~deb9u1 Copyright (c) 2000-2019 the FFmpeg developers             
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516                                 
  configuration: --prefix=/usr --extra-version='1~deb9u1' --toolchain=hardened --libdir=/
usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-st
ripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-li
bass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libeb
ur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi -
-enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenm
pt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-l
ibsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-l
ibtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
e-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal 
--enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprin
t --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared                    
  libavutil      55. 34.101 / 55. 34.101                                                 
  libavcodec     57. 64.101 / 57. 64.101                                                 
  libavformat    57. 56.101 / 57. 56.101                                                 
  libavdevice    57.  1.100 / 57.  1.100                                                 
  libavfilter     6. 65.100 /  6. 65.100                                                 
  libavresample   3.  1.  0 /  3.  1.  0                                                 
  libswscale      4.  2.100 /  4.  2.100                                                 
  libswresample   2.  3.100 /  2.  3.100                                                 
  libpostproc    54.  1.100 / 54.  1.100                                                 
Hyper fast Audio and Video encoder                                                       
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...   
                                                                                         
Use -h to get full help or, even better, run 'man ffmpeg'```

