diff --git a/client.go b/client.go index 5cbeb3e9..5d9f37b2 100644 --- a/client.go +++ b/client.go @@ -977,8 +977,14 @@ func (c *Client) connOpen() error { return fmt.Errorf("RTSPS can be used only with TCP") } - if !strings.Contains(c.host, ":") { - c.host += ":554" + // add default port + _, _, err := net.SplitHostPort(c.host) + if err != nil { + if c.scheme == "rtsp" { + c.host = net.JoinHostPort(c.host, "554") + } else { // rtsps + c.host = net.JoinHostPort(c.host, "8322") + } } ctx, cancel := context.WithTimeout(c.ctx, c.ReadTimeout)