Skip to content

realtime_stream - 400 Client Error: Bad Request for url: <ip> #172

Open
@Moortiii

Description

@Moortiii

I'm trying to stream a realtime recording from an Amcrest IP4M camera via Wifi. The camera connects just fine, and can be controlled and take snapshots. When I try to connect using realtime_stream, the HTTP API throws 400 Client Error: Bad Request for url: http://192.168.1.173:80/cgi-bin/realmonitor.cgi?action=getStream&channel=1&subtype=0.

I have tried changing the channel and sub-type accordingly, referencing the HTTP API Docs.

Minimal example:

from amcrest import AmcrestCamera

camera = AmcrestCamera('192.168.1.173', 80, <username>, <password>).camera
print("Information:", camera.software_information)
print("Video enabled:", camera.video_enabled)

camera.snapshot(0, "/home/user/Pictures/snapshot00.jpeg")
camera.realtime_stream(path_file="/home/user/Pictures/rt_stream_test")

Output:

Information: ('version=2.620.00AC000.3.R', 'build:2019-09-19\r\n')
Video enabled: True

Traceback:

<AMC047CF_625EBA:AMC047CF40F8625EBA> Trying again due to error: HTTPError('400 Client Error: Bad Request for url: http://192.168.1.173:80/cgi-bin/realmonitor.cgi?action=getStream&channel=1&subtype=0')
<AMC047CF_625EBA:AMC047CF40F8625EBA> Trying again due to error: HTTPError('400 Client Error: Bad Request for url: http://192.168.1.173:80/cgi-bin/realmonitor.cgi?action=getStream&channel=1&subtype=0')
<AMC047CF_625EBA:AMC047CF40F8625EBA> Trying again due to error: HTTPError('400 Client Error: Bad Request for url: http://192.168.1.173:80/cgi-bin/realmonitor.cgi?action=getStream&channel=1&subtype=0')
Traceback (most recent call last):
  File "/home/user/dev/embedded/venv/lib/python3.7/site-packages/amcrest/http.py", line 204, in _command
    resp.raise_for_status()
  File "/home/user/dev/embedded/venv/lib/python3.7/site-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://192.168.1.173:80/cgi-bin/realmonitor.cgi?action=getStream&channel=1&subtype=0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 7, in <module>
    camera.realtime_stream(path_file="/home/user/Pictures/rt_stream_test",)
  File "/home/user/dev/embedded/venv/lib/python3.7/site-packages/amcrest/special.py", line 34, in realtime_stream
    channel, typeno), stream=True
  File "/home/user/dev/embedded/venv/lib/python3.7/site-packages/amcrest/http.py", line 169, in command
    return self._command(*args, **kwargs)
  File "/home/user/dev/embedded/venv/lib/python3.7/site-packages/amcrest/http.py", line 209, in _command
    raise CommError(error)
amcrest.exceptions.CommError: 400 Client Error: Bad Request for url: http://192.168.1.173:80/cgi-bin/realmonitor.cgi?action=getStream&channel=1&subtype=0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions