3

Friends, i'm trying to record a video using IP Camera in python2. I can able to get only device name using "devicemgmt", similarly i am doing for "media" and "recording".Error comes like this.


for media: "WARNING:suds.umx.typed:attribute (ViewMode) type, not-found"


for recording: "onvif.exceptions.ONVIFError: Unknown error: Device doesn`t support service: recording"

Can anyone please share the idea if you know.

2 Answers2

1

In your situation, ONVIF is just a way to get the RTSP address of the video stream to capture. Instead, you might search for a way to capture RTSP.

If you can't find the RTSP address of the camera, you might try ONVIF Device Manager. With this software, you will be able to retrieve the RTSP address of the camera. Here are some screenshots of how to find the RTSP address: https://surveilleur.com/2019/02/25/adresse-rtsp-dune-camera-onvif/

Gardinal
  • 74
  • 6
0

You can use software motion, for motion detection and recording video. It is highly configurable.

I can share with you, piece of my code (python), where I capturing only one frame from IP camera using openCV.

import urllib.request
import cv2
import numpy as np

def CaptureFrontCamera():
    _bytes = bytes()
    stream = urllib.request.urlopen('http://192.168.0.51/video.cgi?resolution=1920x1080')
    while True:
        _bytes += stream.read(1024)
        a = _bytes.find(b'\xff\xd8')
        b = _bytes.find(b'\xff\xd9')
        if a != -1 and b != -1:
            jpg = _bytes[a:b+2]
            _bytes = _bytes[b+2:]
            filename = '/home/pi/capture.jpeg'
            i = cv2.imdecode(np.fromstring(jpg, dtype=np.uint8), cv2.IMREAD_COLOR)
            cv2.imwrite(filename, i)
            return filename
Koxo
  • 507
  • 4
  • 10