tchellomello / python-amcrest

A Python 2.7/3.x module for Amcrest and Dahua Cameras using the SDK HTTP API.
GNU General Public License v2.0
213 stars 76 forks source link

Streaming from IP4M-1051W? #203

Open allComputableThings opened 2 years ago

allComputableThings commented 2 years ago

I'm trying to stream from a IP4M-1051W

from amcrest import AmcrestCamera

user = 'admin'
password = '*****'
hostname = '10.0.1.104'

conn = AmcrestCamera(
    host=hostname,
    port=80,
    # user=None,
    # password=None,
    user=user,
    password=password
)

camera = conn.camera
print(camera.software_information)                                            # Success
camera.snapshot(channel=0, path_file="./snapshot00.0.jpeg")  # Success
camera.snapshot(channel=1, path_file="./snapshot00.1.jpeg")  # Success

for (channel, typeno) in [
    (1, 0),
    (0, 1),
    (0, 0),
    (1, 1),
]:
    try:
        print(f"channel={channel}  typeno={typeno}")
        camera.realtime_stream(path_file="./vid.mp4",
                               channel=channel,
                               typeno=typeno
                               )
    except Exception as e:
        print(e)

... connects to the camera, performs screenshots, but fails with:

 <AMC0479C_73416F:AMC0479C650B73416F> Trying again due to error: HTTPError('400 Client Error: Bad Request for url: http://10.0.1.104:80/cgi-bin/realmonitor.cgi?action=getStream&channel=1&subtype=0')
400 Client Error: Bad Request for url: http://10.0.1.104:80/cgi-bin/realmonitor.cgi?action=getStream&channel=1&subtype=0

I see that IP4M-1051B is supported (I assume this is IP4M-1051W but in black).

Is streaming not supported for this model, or am I using the API wrong?

Thanks in advance.