Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlt8 committed Jun 1, 2023
2 parents 40d573d + c67cef5 commit f54cf7a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ It just works!

Streams direct from camera without additional bandwidth or subscriptions.

Based on [@noelhibbard's script](https://gist.github.com/noelhibbard/03703f551298c6460f2fd0bfdbc328bd#file-readme-md) with [kroo/wyzecam](https://github.com/kroo/wyzecam) and [aler9/mediamtx](https://github.com/aler9/mediamtx).
Based on [@noelhibbard's script](https://gist.github.com/noelhibbard/03703f551298c6460f2fd0bfdbc328bd#file-readme-md) with [kroo/wyzecam](https://github.com/kroo/wyzecam) and [bluenviron/mediamtx](https://github.com/bluenviron/mediamtx).


Please consider ⭐️ starring or [☕️ sponsoring](https://ko-fi.com/mrlt8) this project if you found it useful, or use the [affiliate link](https://amzn.to/3NLnbvt) when shopping on amazon!
Expand Down
9 changes: 9 additions & 0 deletions app/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ See [wiki](https://github.com/mrlt8/docker-wyze-bridge/wiki/Camera-Commands) for
* NEW: start/stop/enable/disable over MQTT.
* FIXED: camera busy on re-connect.

## What's Changed in v2.1.8

* NEW: Camera Commands
* `set_pan_cruise_on`/ `set_pan_cruise_off` - Enables or disables the Pan Scan ("Cruise") behavior, where the camera cycles through configured waypoints every 10 seconds. Thanks @jhansche
* `set_motion_tracking_on`/`set_motion_tracking_off`/`get_motion_tracking` - Follow detected motion events on Pan Cams. Thanks @jhansche
* NEW: ENV Option
* `ROTATE_IMG_CAM_NAME=<true|0|1|2|3>` - Rotate snapshots for a single camera. #804
* UPDATE: MediaMTX to v0.23.3
* UPDATE: WebRTC offer to use SDP for compatibility with MTX v0.23.3

## What's Changed in v2.1.7

Expand Down
18 changes: 9 additions & 9 deletions app/static/webrtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,15 @@ class Receiver {
fetch(this.signalJson.whep, {
method: 'POST',
headers: { 'Content-Type': 'application/sdp' },
body: JSON.stringify(desc),
body: desc.sdp,
})
.then((res) => {
if (res.status !== 201) {
throw new Error('Bad status code');
}
if (res.status !== 201) { throw new Error('Bad status code'); }
this.eTag = res.headers.get('E-Tag');
return res.json();
return res.text();
})
.then((answer) => this.onRemoteDescription(answer))
.then((sdp) => this.onRemoteDescription(sdp))
.catch((err) => this.onClose(err));

}
sendToServer(action, payload) {
this.ws.send(JSON.stringify({ "action": action, "messagePayload": btoa(JSON.stringify(payload)), "recipientClientId": this.signalJson.ClientId }));
Expand Down Expand Up @@ -156,10 +153,13 @@ class Receiver {
}
}

onRemoteDescription(answer) {
onRemoteDescription(sdp) {
if (this.restartTimeout !== null) { return; }

this.pc.setRemoteDescription(new RTCSessionDescription(answer));
this.pc.setRemoteDescription(new RTCSessionDescription({
type: 'answer',
sdp,
}));

if (this.queuedCandidates.length !== 0) {
this.sendLocalCandidates(this.queuedCandidates);
Expand Down
6 changes: 6 additions & 0 deletions app/wyzebridge/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,15 @@ def rtsp_snap_cmd(cam_name: str, interval: bool = False):
img = file.format(cam_name=cam_name, CAM_NAME=cam_name.upper())
os.makedirs(os.path.dirname(img), exist_ok=True)

rotation = []
if rotate_img := env_bool(f"ROTATE_IMG_{cam_name}"):
transpose = rotate_img if rotate_img in {"0", "1", "2", "3"} else "clock"
rotation = ["-filter:v", f"{transpose=}"]

return (
["ffmpeg", "-loglevel", "fatal", "-analyzeduration", "0", "-probesize", "32"]
+ ["-f", "rtsp", "-rtsp_transport", "tcp", "-thread_queue_size", "500"]
+ ["-i", f"rtsp://{auth}0.0.0.0:8554/{cam_name}", "-map", "0:v:0"]
+ rotation
+ ["-f", "image2", "-frames:v", "1", "-y", img]
)
2 changes: 2 additions & 0 deletions app/wyzebridge/hass.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def setup_hass(hass_token: Optional[str]) -> None:
environ[f"NET_MODE_{cam_name}"] = str(cam["NET_MODE"])
if "ROTATE" in cam:
environ[f"ROTATE_CAM_{cam_name}"] = str(cam["ROTATE"])
if "ROTATE_IMG" in cam:
environ[f"ROTATE_IMG_{cam_name}"] = str(cam["ROTATE_IMG"])
if "QUALITY" in cam:
environ[f"QUALITY_{cam_name}"] = str(cam["QUALITY"])
if "LIVESTREAM" in cam:
Expand Down

0 comments on commit f54cf7a

Please sign in to comment.