-
-
Notifications
You must be signed in to change notification settings - Fork 180
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
allow empty password on camera #834
Comments
A workaround is to abuse this code...
and jam the auth into the hostname :)
|
Smart workaround! Changing the code to this: def get_stream_url(self, stream_config: dict[str, Any]) -> str:
"""Return stream url."""
auth = ""
if (
self._config[CONFIG_USERNAME] is not None
and self._config[CONFIG_PASSWORD] is not None
):
auth = (
f"{self._config[CONFIG_USERNAME]}"
":"
f"{escape_string(self._config[CONFIG_PASSWORD])}"
"@"
)
protocol = (
stream_config[CONFIG_PROTOCOL]
if stream_config[CONFIG_PROTOCOL]
else STREAM_FORMAT_MAP[stream_config[CONFIG_STREAM_FORMAT]]["protocol"]
)
return (
f"{protocol}://"
f"{auth}"
f"{self._config[CONFIG_HOST]}:{stream_config[CONFIG_PORT]}"
f"{stream_config[CONFIG_PATH]}"
) WIth this config: ffmpeg:
camera:
camera1:
name: Camera 1
host: ipcamera.iot
port: 554
path: /onvif/profile.0
username: admin
password: "" Produces this result: Is that the correct format for your use case? |
Behavior LGTM. I have no idea if escape_string is right for password (nor if 'no-op' is the right thing for username), but that hasn't changed. As a code clarity note, consider making local def get_stream_url(self, stream_config: dict[str, Any]) -> str:
username = self._config[CONFIG_USERNAME]
password = self._config[CONFIG_PASSWORD]
auth = ""
if username is not None and password is not None:
auth = f"{username}:{escape_string(password)}@" |
Looks good, thanks for the suggestion! Will be in |
This works:
ffprobe rtsp://admin:@cam-li:554/
But this config fails:
camera_li: { name: li, host: cam-li, port: 554, path: /, username: admin, password: "", width: 2048, height: 1536, fps: 10, codec: h264, audio_codec: aac }
I wish https://github.com/roflcoopter/viseron/blob/dev/viseron/components/ffmpeg/stream.py#L210 only checked username, and perhaps that 214 defaulted to empty string.
The text was updated successfully, but these errors were encountered: