Problems with HSV recording using Unifi 3G cameras
Hello,

Camera streams work fine to Apple Home apps,  but the recording won't work. I have followed some configuration examples that are supposed to work. I set the atHomeSwitch to "true" since camera.ui only sends motion sensor events if I'm away from home, but that is another issue. 

I have set "Stream & Allow Recording" in Home app both When Home and When Away. I do have icloud+ 200GB

Here is my homebridge-camera-ui json.conf and the log files below that. 

{
    "name": "CameraUI",
    "atHomeSwitch": true,
    "debug": true,
    "mqtt": {
        "active": false
    },
    "http": {
        "active": false,
        "port": 7272,
        "localhttp": false
    },
    "smtp": {
        "active": false
    },
    "ftp": {
        "active": false,
        "port": 5050
    },
    "ssl": {
        "active": false
    },
    "cameras": [
        {
            "name": "Front door",
            "motion": true,
            "switches": true,
            "unbridge": true,
            "hsv": true,
            "prebuffering": true,
            "prebufferLength": 4000,
            "videoConfig": {
                "source": "-i rtsps://192.168.8.10:7441/QxGfWWGXHxdggo9H?enableSrtp",
                "subSource": "-i rtsps://192.168.8.10:7441/lv8jpmSSkg62CBBB?enableSrtp",
                "stillImageSource": "-i rtsps://192.168.8.10:7441/lv8jpmSSkg62CBBB?enableSrtp",
                "rtspTransport": "tcp",
                "vcodec": "copy",
                "acodec": "libfdk_aac",
                "audio": false,
                "debug": false
            },
            "videoanalysis": {
                "active": true
            }
        },
    ],
    "_bridge": {
        "username": "0E:58:2B:A2:F8:6E",
        "port": 59758
    },
    "platform": "CameraUI"
}

Logs after I trigger event with Motion trigger

[15/01/2022, 23:41:22] [CameraUI] Front door: Motion ON
[15/01/2022, 23:41:22] [CameraUI] Front door: Snapshot requested: 1280 x 720
[15/01/2022, 23:41:22] [CameraUI] Front door: Snapshot command: /usr/local/lib/node_modules/homebridge-camera-ui/node_modules/ffmpeg-for-homebridge/ffmpeg -hide_banner -loglevel error -analyzeduration 0 -probesize 500000 -f mpegts -i tcp://127.0.0.1:29434 -frames:v 1 -f image2 -
[15/01/2022, 23:41:22] [CameraUI] Front door: Video fragments requested from HSV
[15/01/2022, 23:41:22] [CameraUI] Front door: Setting prebuffer stream as input
[15/01/2022, 23:41:22] [CameraUI] Front door: Prebuffer requested with a duration of -4s
[15/01/2022, 23:41:22] [CameraUI] Front door: Start recording...
[15/01/2022, 23:41:22] [CameraUI] Front door: Recording command: /usr/local/lib/node_modules/homebridge-camera-ui/node_modules/ffmpeg-for-homebridge/ffmpeg -hide_banner -analyzeduration 0 -probesize 500000 -f mp4 -i tcp://127.0.0.1:20880 -f mp4 -vcodec copy -an -movflags frag_keyframe+empty_moov+default_base_moof -max_muxing_queue_size 1024 tcp://127.0.0.1:29303
[15/01/2022, 23:41:22] [CameraUI] Front door: Prebuffer request ended
[15/01/2022, 23:41:22] [CameraUI] Front door: Fetching snapshot took 0.38 seconds.
[15/01/2022, 23:41:22] [CameraUI] Front door: Sending snapshot: 1280x720
[15/01/2022, 23:41:22] [CameraUI] Front door: Resize command: /usr/local/lib/node_modules/homebridge-camera-ui/node_modules/ffmpeg-for-homebridge/ffmpeg -i pipe: -frames:v 1 -filter:v scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease -f image2 -
[15/01/2022, 23:41:22] [CameraUI] Front door: Recording started
[15/01/2022, 23:41:25] [CameraUI] Front door: Closing recording process
[15/01/2022, 23:41:25] [CameraUI] Resetting motion state because HSV closed recording with reason "5"
[15/01/2022, 23:41:25] [CameraUI] Front door: FFMPEG socket closed during read for 8 bytes!
[15/01/2022, 23:41:25] [CameraUI] Front door: Skip saving the recording, the file might be corrupted because the recording process was cancelled by HSV
[15/01/2022, 23:41:25] [CameraUI] Front door: Prebuffer request ended
[15/01/2022, 23:41:25] [CameraUI] Front door: FFmpeg recording process exited (expected)


**Environment**
- Node.js Version: v16.13.2
- Homebridge Version: v1.4.0-beta.4
- Camera UI Version: v5.0.7 
- Operating System: Linux homebridge 5.10.17-v7+
- Browser: Firefox 95.0.2
