Video Quality Issue on Doorbell G4 Pro
<!-- FEATURE REQUESTS THAT ARE NOT FILLED OUT COMPLETELY WILL BE CLOSED AUTOMATICALLY WITHOUT WARNING AND WILL NOT RECEIVE A RESPONSE. THE FORM IS HERE FOR A REASON. :). -->
<!-- Please ensure you read the documentation before creating a feature request to ensure the functionality doesn't already exist. -->

**Is your feature request related to a problem? Please describe:**
<!-- A clear and concise description of what the problem is or what use case you would like to see supported. e.g. I'm always frustrated when [...] -->

The automatic RTSP feed selection *seems* incoherent on my Doorbell G4 Pro.

**Describe the solution you'd like:**
<!-- A clear and concise description of what you want to happen. -->

When HomeKit requests for a 640x480@30fps feed, the plugin transcodes the low quality feed (480x360@15fps) instead of transcoding the medium quality (960x720) which seems to better match the request.

**Describe alternatives you've considered:**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->

I could have forced the use of the medium, or higher quality feed in the configuration file, but I'd rather avoid to do that...

**Additional context:**
<!-- Add any other context or screenshots about the feature request here. -->

Hi,

First of all, thank you SO MUCH for your great plugin, which is exactly what I was looking for!

This is a re-post of my previous issue, because it has been automatically closed as I haven't clicked on the "New Issue" button, but instead clicked on the source code, which only creates a blank issue, missing the requested formatting 😄. Sorry about that.

I would have a question / improvement request regarding how the RTSP stream is selected.

At the moment, I have multiple cameras which all work very well. I've recently added a doorbell in my house, but I have a very low quality video displayed in the HomeKit on macOS. I have read your documentation, and learned that your plugin was trying to select the best RTSP stream according to the HomeKit request. In my case, HomeKit asks for a 640x480@30fps stream, but the 480x360@15fps stream is selected. Shouldn't it be the stream medium stream instead (960x720)?

I've read in the documentation that it was possible to force the usage of a given stream on a per-device basis, but I wanted to understand why the low stream was chosen instead of the medium one.

By reading your code (please forgive me if I haven't properly understood the code, I've never written any TypeScript code, I'm more of a C++ / assembly language guy 😄), I saw this at [protect-camera.ts:1231](https://github.com/hjdhjd/homebridge-unifi-protect/blob/bf9b3117ea41d0ab341c76cbc1b608bbbf1f48bd/src/protect-camera.ts#L1231C2-L1231C2):

```ts
return rtspEntries.find(x => width >= x.resolution[0]) ?? rtspEntries[rtspEntries.length - 1];
```

The lambda expression seems weird: if the array is sorted by width, it selects the first RTSP stream which has a width lower than the requested one, doesn't it? Shouldn't it be written:

```ts
return rtspEntries.filter(x => width < x.resolution[0]).pop() ?? rtspEntries[rtspEntries.length - 1];
```

In that case, the plugin would select the lowest stream which has a larger width than requested?

<!-- Click the "Preview" tab before you submit to ensure the formatting is correct. -->
