1

The script is just suppose to grab a frame from the RTSP stream and save it every 60 seconds. The block below checks if it is a valid connection. I.e User/Password and IP is correct and in this case to wait if the camera becomes disconnected.

The script connects and saves the frame correctly.

video = cv2.VideoCapture('rtsp://user:[email protected]/stream/', cv2.CAP_FFMPEG)
try:
    if video.isOpened():
        ref, frame = video.read()
        cv2.imwrite("frame%d.jpg" % ref, frame)
except Exception as e:
    print(e)

However after that it throws a notice

[rtsp @ 0000022c41432c0] method DESCRIBE failed: 401 Unauthorized

Am I not setting up the device correctly? Or is it possible the device does not support DESCRIBE or is implemented poorly?

3
  • That is not a OpenCV error, I believe its a ffmpeg error. In the past I've received that error due to incorrect login credentials to access the RTSP stream. Check your credentials and try again, also insert the stream link to VLC to verify that your link is working Commented Nov 22, 2019 at 0:49
  • That's the catch, I can connect just fine. Snapshot works. Just throws that after. Commented Nov 22, 2019 at 1:50
  • Maybe the username or password is not correct. 401 means: The request was not authorized for authentication or the verification failed. Commented Nov 22, 2019 at 6:50

3 Answers 3

1

Just had a similar experience in an environment using hikvision cameras.

When creating/updating your password the interface suggests...

8 to 16 characters allowed, including upper-case letters, lower-case letters, digits and special characters (!"#$%&'()*+,-./:;<=>?@[]^_`{|}~ space)

Notice the 16 character upper limit, it will truncate that password so for a quick example

ThisPasswordWillBeTruncated

Will result in the password being saved as

ThisPasswordWill

Sign up to request clarification or add additional context in comments.

Comments

0

In my case, it was just due to wrong password. This must be password set for the user in the camera set-up.

Comments

0

Special characters must be converted to another format like this:

# -> %23
$ -> %24

ex.
    source = 'rtsp://username:1234#$@~~~'
->
    source = 'rtsp://username:1234%23%24@~~~'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.