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

Support for camera channels #9

Open
AlbertoLopSie opened this issue Jan 16, 2021 · 2 comments
Open

Support for camera channels #9

AlbertoLopSie opened this issue Jan 16, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@AlbertoLopSie
Copy link

Hi Renier,
I noted you are using the camera local IP and port got from py-ezviz to build a RTSP MRL.

if camera["serial"] in conf_cameras:
camera_username = conf_cameras[camera["serial"]][CONF_USERNAME]
camera_password = conf_cameras[camera["serial"]][CONF_PASSWORD]
camera_rtsp_stream = f"rtsp://{camera_username}:{camera_password}@{camera['local_ip']}:{local_rtsp_port}"
_LOGGER.debug(
"Camera %s source stream: %s", camera["serial"], camera_rtsp_stream
)

You are using the default camera channel MRL syntax;

rtsp://admin:<PASSWORD>@<IP-ADDR>:<PORT>

However, If you used the form:

rtsp://admin:<PASSWORD>@<IP-ADDR>:<PORT>/Streaming/Channels/10x

You would be able to access additional channels supported by many EzViz cameras. For example, my CS-CV206 Mini-O camera supports 2 channels:

$ ffprobe -hide_banner rtsp://admin:<PASSWORD>@<IP-ADDR>:554/Streaming/Channels/101
Input #0, rtsp, from 'rtsp://admin:<PASSWORD>@192.168.1.243:554/Streaming/Channels/101':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 1920x1080, 14.99 tbr, 90k tbn, 180k tbc
    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp

$ ffprobe -hide_banner rtsp://admin:<PASSWORD>@<IP-ADDR>:554/Streaming/Channels/102
Input #0, rtsp, from 'rtsp://admin:<PASSWORD>@<IP-ADDR>:554/Streaming/Channels/102':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 768x432, 14.99 tbr, 90k tbn, 180k tbc
    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp

As you can see, Channel 1 (101) produces a 1920x1080 video stream and channel 2 (102) a 768x432 one.

Second (LoRes) channel is suitable for displaying into a card in the Lovelace UI while the HiRes channel could be used to feed a Chromecast on a HDTV.

Not all cameras support more than one channel (C3A doesn't) because is supposed you will connect to only one channel at a time (to save battery I guess) and you would need to use an API call to set the default channel resolution before.

Info about channel support can be obtained from the JSON responses py-ezviz API call uses.

It would be a matter of generating one HA camera per channel to be able to get all them on HA. To make it simple, a config variable in ezviz_cloud.yaml could set the upper limit (channels: 2, for example) absence of that key would produce a single channel HA camera.

Hope it helps!!

@RenierM26
Copy link
Owner

Hi AlbertoLopSie,

I've added an ffmpeg arguments option to the integration. This will allow you to add /Streaming/Channels/101 or 102 to the end of the rtsp string. The rtsp string will also show under device attributes to make troubleshooting easier.

I'm still hoping I can find a "subchannel supported" string from the api to automate this.

@RenierM26
Copy link
Owner

This can now be set per camera on the last two versions.

@RenierM26 RenierM26 added the enhancement New feature or request label Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants