Release Foscam HD - Video feed with camera controls, and motion/sound detection preview
Two changes fixed the motion detection pop up for my FI9831P camera.

1) Change in addons/script.foscam/resources/lib/utils.py
Alter the get_mjpeg_frame function to look like this. Seems sometimes the headers aren't consistent, or the previous frame doesnt end in a carriage return meaning you need a different number of readlines frame to frame. My change will keep reading the stream till it finds the content length header its looking for.

def get_mjpeg_frame(stream):
try:
content_length = stream.readline()
while not "Content-Length" in content_length:
content_length = stream.readline()
bytes = int(content_length.split(':')[-1])
stream.readline()
return stream.read(bytes)
except requests.RequestException as e:
utils.log_error(str(e))
return None


2) Change alter addons/script.foscam/resources/lib/foscam.py
Alter self._stream_url_fmt line to look like this. The url had to be changed as my camera is very particular about the ordering of the get parameters, username had to come first thus the 'Username required' error. Also the username/pass is passed as get parameters as below not as basic http creds.


self._stream_url_fmt = "http://{0}:{1}/cgi-bin/CGIStream.cgi?usr={2}&pwd={3}&cmd={{cmd}}".format(host,
port,
user,
password)
Reply


Messages In This Thread
RE: Foscam HD - by George - 2014-03-27, 17:30
RE: Foscam HD - Video feed with camera controls, and motion/sound detection preview - by quixers - 2015-02-13, 00:44
Logout Mark Read Team Forum Stats Members Help
Foscam HD - Video feed with camera controls, and motion/sound detection preview1