Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove RTMP streams for nvr connected cams #1650

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion plugins/reolink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ Reolink Cameras offer both RTMP and RTSP streams. RTMP streams are more reliable
## Feature Support

* Reolink Cameras
* Two Way Audio - Reolink Two Way Audio is not supported. It is a proprietary and undocumented protocol.
* PTZ - Supported for most of the reolink cameras in the Advanced section. ONVIF PTZ plugin won't work correctly
* Two Way Audio - Reolink Two Way Audio is not supported. It is a proprietary and undocumented protocol. For a few cameras it is available through the Advanced section (confirmed working on E1 zoom, E1 outdoor, E1 POE, RLC-540A)
* Reolink Doorbells
* Enable the Doorbell checkbox in the Scrypted settings for the Reolink device.
* The Reolink Doorbell supports two way audio via ONVIF. Reolink Cameras do not support this feature.
* Reolink Trackmix
* All the RTSP streams are provided within the same camera. The camera should be added only with the channel 0 twice and select the appropriate streams

Some Reolink cameras support the ONVIF protocol. It may be worth experimenting with the ONVIF plugin instead. Using the Reolink Plugin is generally recommended due to the additional stream that is made available.

Expand Down
30 changes: 19 additions & 11 deletions plugins/reolink/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,21 +703,29 @@ class ReolinkCamera extends RtspSmartCamera implements Camera, DeviceProvider, R
// anecdotally, encoders of type h265 do not have a working RTMP main stream.
const mainEncType = this.storageSettings.values.abilities?.value?.Ability?.abilityChn?.[rtspChannel].mainEncType?.ver;

if (live === 2) {
if (mainEncType === 1) {
streams.push(rtmpSub, rtspMain, rtspSub);

if (deviceInfo.isNvr) {
// NVR connected cameras are very unstable on the RTMP stream, keep only the ext to have a 3th stream
streams.push(rtspMain, rtspSub);
if(mainEncType === 1) {
streams.push(rtmpExt);
}
} else {
if (live === 2) {
if (mainEncType === 1) {
streams.push(rtmpSub, rtspMain, rtspSub);
}
else {
streams.push(rtmpMain, rtmpSub, rtspMain, rtspSub);
}
}
else if (mainEncType === 1) {
streams.push(rtmpExt, rtmpSub, rtspMain, rtspSub);
}
else {
streams.push(rtmpMain, rtmpSub, rtspMain, rtspSub);
streams.push(rtmpMain, rtmpExt, rtmpSub, rtspMain, rtspSub);
}
}
else if (mainEncType === 1) {
streams.push(rtmpExt, rtmpSub, rtspMain, rtspSub);
}
else {
streams.push(rtmpMain, rtmpExt, rtmpSub, rtspMain, rtspSub);
}


// https://github.com/starkillerOG/reolink_aio/blob/main/reolink_aio/api.py#L93C1-L97C2
// single motion models have 2*2 RTSP channels
Expand Down
1 change: 1 addition & 0 deletions plugins/reolink/src/probe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface DevInfo {
serial: string;
type: string;
wifi: number;
isNvr?: boolean;
}

async function getDeviceInfo(host: string, username: string, password: string): Promise<DevInfo> {
Expand Down
4 changes: 3 additions & 1 deletion plugins/reolink/src/reolink-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,10 @@ export class ReolinkCameraClient {

const deviceInfo: DevInfo = await response.body?.[0]?.value?.DevInfo;

const isNvr = ['HOMEHUB', 'NVR', 'NVR_WIFI'].includes(deviceInfo.exactType);
deviceInfo.isNvr = isNvr;
// Will need to check if it's valid for NVR and NVR_WIFI
if (!['HOMEHUB', 'NVR', 'NVR_WIFI'].includes(deviceInfo.exactType)) {
if (!isNvr) {
return deviceInfo;
}

Expand Down