Hikvision ColorVu DS-2CD2347G2-L(U), Homekit video stream problems
Hey, everybody,
first of all, I would like to thank you for the great work you are doing with this plugin. I've been using camera-ui for almost a year now with four different Dahua cameras, without major problems, even with HSV support. But about two months ago I bought another camera to monitor our patio, which has been visited several times by a burglar. I chose the Hikvision ColorVu DS-2CD2347G2-L(U) and that's when my problems began. I'm not a complete newby, on the contrary I have quite a bit of experience, but I'm slowly losing this fight because I've tried everything I know.

When I open the main stream in the web administration of the camera, everything is OK. When I start this stream in VLC, everything is also OK. Even in Synology Surveillance Station, which I use for recordings and as the main point of our security, the stream goes without any problems. But when I want to open a video stream in homekit, using your plugin, the video is choppy, frames are unstable, delayed by 10 seconds compared to the audio track. Sometimes it drops out, or doesn't even start with the information that the camera is unavailable. Especially outside the local network.

My problems are long term, so I've tried several versions of Homebridge, CameraUI and other features. 
**Current Docker setup on my Synology is:**

- Homebridge [v1.5.0] - latest
- Homebridge UI v4.50.1
- Node.js v16.16.0
- Camera UI v5.0.27
- My video processor is set to default ffmpeg.


**And here is the camera configuration with the described problems:**

> {
            "name": "Terasa, Camera Ui",
            "manufacturer": "Hikvision",
            "model": "DS-2CD2347G2-LU",
            "serialNumber": "DS-2CD2347G2-LU20211006AAWRG82841489",
            "motion": true,
            "switches": true,
            "motionTimeout": 15,
            "unbridge": false,
            "hsv": true,
            "prebuffering": false,
            "forcePrebuffering": false,
            "prebufferLength": 6,
            "hksvConfig": {
                "source": "-i rtsp://USERNAME:PASSWORD@192.168.0.34:554/Streaming/Channels/101/",
                "maxWidth": 2688,
                "maxHeight": 1520,
                "maxFPS": 25,
                "maxBitrate": 8192,
                "vcodec": "copy",
                "acodec": "libfdk_aac",
                "encoderOptions": "-preset ultrafast"
            },
            "videoConfig": {
                "source": "-i rtsp://USERNAME:PASSWORD@192.168.0.34:554/Streaming/Channels/101/",
                "subSource": "-i rtsp://USERNAME:PASSWORD@192.168.0.34:554/Streaming/Channels/102/",
                "stillImageSource": "-i rtsp://USERNAME:PASSWORD@192.168.0.34:554/Streaming/Channels/101/picture",
                "readRate": false,
                "rtspTransport": "tcp",
                "maxStreams": 2,
                "maxWidth": 1280,
                "maxHeight": 720,
                "maxFPS": 30,
                "maxBitrate": 2048,
                "forceMax": false,
                "vcodec": "copy",
                "acodec": "libfdk_aac",
                "packetSize": 376,
                "encoderOptions": "-preset ultrafast",
                "audio": false,
                "debug": false
            },
            "smtp": {
                "email": "Terasa, Camera Ui"
            },
            "videoanalysis": {
                "active": true
            },
            "mqtt": {}
        }

Of course I checked my internet connection and my network overall, although all other cameras of similar parameters work just fine. I also tried turning on/off unbridge, prebuffering, HSV and audio track. I've tried different codec settings, perhaps all packet size variations. Sometimes it seemed a little better, but I didn't solve the problem.

Anyone have any idea what could be wrong? I can't really think of anything anymore, and it annoys me that the most expensive and otherwise great camera, doesn't work well in our Homekit.