Skip to content

Commit

Permalink
Add native arm64v8 support (#1059)
Browse files Browse the repository at this point in the history
* Add native arm64v8 support

* TARGETARCH ARG

* use if-else

* fix FFMPEG_ARCH for arm32v7

use case

* use if-else to avoid issues with case

* Bump to python 3.12

* typo

* Add MQTT_RETRIES to HAS

* gcc for arm wheels

* changelog
  • Loading branch information
mrlt8 authored Dec 7, 2023
1 parent 9621b93 commit 1c76882
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 96 deletions.
90 changes: 44 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

Create a local WebRTC, RTSP, RTMP, or HLS/Low-Latency HLS stream for most of your Wyze cameras including the outdoor, doorbell, and 2K cams.

No third-party or special firmware required.
No modifications, third-party, or special firmware required.

It just works!

Expand Down Expand Up @@ -53,40 +53,55 @@ You can then use the web interface at `http://localhost:5000` where localhost is

See [basic usage](#basic-usage) for additional information or visit the [wiki page](https://github.com/mrlt8/docker-wyze-bridge/wiki/Home-Assistant) for additional information on using the bridge as a Home Assistant Add-on.

## What's Changed in v2.5.3
## What's Changed in v2.6.0

* FIXED: use static bulma for Pi-Hole compatibility Thanks @MetalliMyers! #1054
* NEW: MQTT/API - Format SD Card using the topic/endpoint `format_sd` Thanks @iferlive! #1053
* NEW: `MQTT_RETRIES` to adjust the number of retires on exception. Defaults to 3 before disabling MQTT. Thanks @rmaes4! #1047
* **NEW**: ARM 64-bit native library (#529 #604 #664 #871 #998 #1004)
The arm64 container now runs in 64-bit mode, addressing compatibility issues, particularly on Apple Silicon M1/M2/M3, when using the Home Assistant Add-on.

## What's Changed in v2.5.2
Resolves issues on the Raspberry Pi 4/5 running the 64-bit version of Raspbian.

* FIX: MQTT Naming Warning in Home Assistant #1046 Thanks @ejpenney!
* NEW: `{img}` variable for `motion_webhooks` #1044
* e.g., `MOTION_WEBHOOKS: http://0.0.0.0:123/webhooks/endpoint?camera={cam_name}&snapshot={img}`
* **Update**: Python 3.11 -> Python 3.12

## What's Changed in v2.5.1

* FIX `ON_DEMAND=False` option was broken in v2.5.0 #1036 #1037
* NEW API/MQTT commands Thanks @ralacher! #921:
* GET: `/api/<cam-name>/accessories` | MQTT: `wyzebridge/<cam-name>/accessories/get`
* SET: `/api/<cam-name>/spotlight` | MQTT: `wyzebridge/<cam-name>/spotlight/set`
[View previous changes](https://github.com/mrlt8/docker-wyze-bridge/releases)

## What's Changed in v2.5.0
## FAQ

* NEW camera support:
* HL_DB2: Wyze Cam Doorbell v2 - thanks @hoveeman!
* HL_CAM4: Wyze Cam V4
* NEW API Endpoint:
* `/api/all/update_snapshot` - trigger interval snapshots via web API #1030
* How does this work?
* It uses the same SDK as the app to communicate directly with the cameras. See [kroo/wyzecam](https://github.com/kroo/wyzecam) for details.
* Does it use internet bandwidth when streaming?
* Not in most cases. The bridge will attempt to stream locally if possible but will fallback to streaming over the internet if you're trying to stream from a different location or from a shared camera. See the [wiki](https://github.com/mrlt8/docker-wyze-bridge/wiki/Network-Connection-Modes) for more details.
* Can this work offline/can I block all wyze services?
* No. Streaming should continue to work without an active internet connection, but will probably stop working after some time as the cameras were not designed to be used without the cloud. Some camera commands also depend on the cloud and may not function without an active connection. See [wz_mini_hacks](https://github.com/gtxaspec/wz_mini_hacks/wiki/Configuration-File#self-hosted--isolated-mode) for firmware level modification to run the camera offline.
* Why aren't all wyze cams supported yet (OG/Doorbell Pro)?
* These cameras are using a different SDK and will require a different method to connect and stream.

## Compatibility

[View previous changes](https://github.com/mrlt8/docker-wyze-bridge/releases)
![Supports arm32v7 Architecture](https://img.shields.io/badge/arm32v7-yes-success.svg)
![Supports arm64v8 Architecture](https://img.shields.io/badge/arm64v8-yes-success.svg)
![Supports amd64 Architecture](https://img.shields.io/badge/amd64-yes-success.svg)
![Supports Apple Silicon Architecture](https://img.shields.io/badge/apple_silicon-yes-success.svg)

[![Home Assistant Add-on](https://img.shields.io/badge/home_assistant-add--on-blue.svg?logo=homeassistant&logoColor=white)](https://github.com/mrlt8/docker-wyze-bridge/wiki/Home-Assistant)
[![Homebridge](https://img.shields.io/badge/homebridge-camera--ffmpeg-blue.svg?logo=homebridge&logoColor=white)](https://sunoo.github.io/homebridge-camera-ffmpeg/configs/WyzeCam.html)
[![Portainer stack](https://img.shields.io/badge/portainer-stack-blue.svg?logo=portainer&logoColor=white)](https://github.com/mrlt8/docker-wyze-bridge/wiki/Portainer)
[![Unraid Community App](https://img.shields.io/badge/unraid-community--app-blue.svg?logo=unraid&logoColor=white)](https://github.com/mrlt8/docker-wyze-bridge/issues/236)

## Supported Cameras
Should work on most x64 systems as well as on most modern arm-based systems like the Raspberry Pi 3/4/5 or Apple Silicon M1/M2/M3.

The container can be run on its own, in [Portainer](https://github.com/mrlt8/docker-wyze-bridge/wiki/Portainer), [Unraid](https://github.com/mrlt8/docker-wyze-bridge/issues/236), as a [Home Assistant Add-on](https://github.com/mrlt8/docker-wyze-bridge/wiki/Home-Assistant), locally or remotely in the cloud.



### Ubiquiti Unifi

> [!NOTE]
> Some network adjustments may be needed - see [this discussion](https://github.com/mrlt8/docker-wyze-bridge/discussions/891) for more information.
## Supported Cameras

| Camera | Model | Tutk Support | Latest FW |
| ----------------------------- | -------------- | ------------------------------------------------------------ | --------- |
| Wyze Cam v1 [HD only] | WYZEC1 || 3.9.4.x |
Expand All @@ -111,29 +126,6 @@ See [basic usage](#basic-usage) for additional information or visit the [wiki pa
| Wyze Cam OG | GW_GC1 | [⚠️](https://github.com/mrlt8/docker-wyze-bridge/issues/677) | - |
| Wyze Cam OG Telephoto 3x | GW_GC2 | [⚠️](https://github.com/mrlt8/docker-wyze-bridge/issues/677) | - |


## Compatibility

![Supports armv7 Architecture](https://img.shields.io/badge/armv7-yes-success.svg)
![Supports aarch64 Architecture](https://img.shields.io/badge/aarch64-yes-success.svg)
![Supports amd64 Architecture](https://img.shields.io/badge/amd64-yes-success.svg)

[![Home Assistant Add-on](https://img.shields.io/badge/home_assistant-add--on-blue.svg?logo=homeassistant&logoColor=white)](https://github.com/mrlt8/docker-wyze-bridge/wiki/Home-Assistant)
[![Homebridge](https://img.shields.io/badge/homebridge-camera--ffmpeg-blue.svg?logo=homebridge&logoColor=white)](https://sunoo.github.io/homebridge-camera-ffmpeg/configs/WyzeCam.html)
[![Portainer stack](https://img.shields.io/badge/portainer-stack-blue.svg?logo=portainer&logoColor=white)](https://github.com/mrlt8/docker-wyze-bridge/wiki/Portainer)
[![Unraid Community App](https://img.shields.io/badge/unraid-community--app-blue.svg?logo=unraid&logoColor=white)](https://github.com/mrlt8/docker-wyze-bridge/issues/236)

Should work on most x64 systems as well as on some arm-based systems like the Raspberry Pi.

The container can be run on its own, in [Portainer](https://github.com/mrlt8/docker-wyze-bridge/wiki/Portainer), [Unraid](https://github.com/mrlt8/docker-wyze-bridge/issues/236), as a [Home Assistant Add-on](https://github.com/mrlt8/docker-wyze-bridge/wiki/Home-Assistant), locally or remotely in the cloud.



### Ubiquiti Unifi

> [!NOTE]
> Some network adjustments may be needed - see [this discussion](https://github.com/mrlt8/docker-wyze-bridge/discussions/891) for more information.
## Basic Usage

### docker-compose (recommended)
Expand Down Expand Up @@ -174,7 +166,7 @@ Visit the [wiki page](https://github.com/mrlt8/docker-wyze-bridge/wiki/Home-Assi

* [Camera Commands (MQTT/REST API)](https://github.com/mrlt8/docker-wyze-bridge/wiki/Camera-Commands)
* [Two-Factor Authentication (2FA/MFA)](https://github.com/mrlt8/docker-wyze-bridge/wiki/Two-Factor-Authentication)
* [ARM/Raspberry Pi](https://github.com/mrlt8/docker-wyze-bridge/wiki/Raspberry-Pi-(armv7-and-arm64))
* [ARM/Apple Silicon/Raspberry Pi](https://github.com/mrlt8/docker-wyze-bridge/wiki/Raspberry-Pi-and-Apple-Silicon-(arm-arm64-m1-m2-m3))
* [Network Connection Modes](https://github.com/mrlt8/docker-wyze-bridge/wiki/Network-Connection-Modes)
* [Portainer](https://github.com/mrlt8/docker-wyze-bridge/wiki/Portainer)
* [Unraid](https://github.com/mrlt8/docker-wyze-bridge/issues/236)
Expand Down Expand Up @@ -236,3 +228,9 @@ WebRTC should work automatically in Home Assistant mode, however, some additiona
* [Proxy Stream from RTSP Firmware](https://github.com/mrlt8/docker-wyze-bridge/wiki/Advanced-Option#proxy-stream-from-rtsp-firmware)
* [BOA HTTP Server/Motion Alerts](https://github.com/mrlt8/docker-wyze-bridge/wiki/Boa-HTTP-Server)
* [Debugging Options](https://github.com/mrlt8/docker-wyze-bridge/wiki/Advanced-Option#debugging-options)

## Other Wyze Projects

* [gtxaspec/wz_mini_hacks](https://github.com/gtxaspec/wz_mini_hacks) - firmware level modification with a [self-hosted mode](https://github.com/gtxaspec/wz_mini_hacks/wiki/Configuration-File#self-hosted--isolated-mode) to use the cameras without the wyze services.
* [jfarmer08/homebridge-wyze-smart-home](https://github.com/jfarmer08/homebridge-wyze-smart-home) - homebridge plugin to interact with other wyze devices over the cloud.
* [shauntarves/wyze-sdk](https://github.com/shauntarves/wyze-sdk) - python library to interact with wyze devices over the cloud.
11 changes: 11 additions & 0 deletions app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## What's Changed in v2.6.0

* **NEW**: ARM 64-bit native library (#529 #604 #664 #871 #998 #1004)

The arm64 container now runs in 64-bit mode, addressing compatibility issues, particularly on Apple Silicon M1/M2/M3, when using the Home Assistant Add-on.

Resolves issues on the Raspberry Pi 4/5 running the 64-bit version of Raspbian.

* **Update**: Python 3.11 -> Python 3.12


## What's Changed in v2.5.3

* FIXED: use static bulma for Pi-Hole compatibility Thanks @MetalliMyers! #1054
Expand Down
29 changes: 15 additions & 14 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
# Use the build args ARM=1 to build for arm.
ARG ARM
ARG BUILD
ARG ARCH=${ARM:+arm32v7}
FROM ${ARCH:-amd64}/python:3.11-slim-bookworm as base
FROM python:3.12-slim-bookworm as base

FROM base as builder
ARG ARM
ARG LIB_ARCH=${ARM:+arm}
ARG MTX_ARCH=${ARM:+armv7}
ARG FFMPEG_ARCH=${ARM:+arm32v7}
RUN apt-get update \
&& apt-get install -y curl tar ${ARM:+gcc} \
&& apt-get install -y curl tar gcc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY . /build/app/
RUN pip3 install --disable-pip-version-check --prefix=/build/usr/local -r /build/app/requirements.txt
RUN cd /build \
RUN echo "BUILDING IMAGE FOR $(uname -m)" && \
if [ "$(uname -m)" = "armv7l" ]; then \
LIB_ARCH=arm; FFMPEG_ARCH=arm32v7; MTX_ARCH=armv7; \
elif [ "$(uname -m)" = "aarch64" ]; then \
LIB_ARCH=arm64; FFMPEG_ARCH=aarch64; MTX_ARCH=arm64v8; \
else \
LIB_ARCH=amd64; FFMPEG_ARCH=x86_64; MTX_ARCH=amd64; \
fi && \
cd /build \
&& . app/.env \
&& mkdir -p tokens img \
&& curl -SL https://github.com/homebridge/ffmpeg-for-homebridge/releases/latest/download/ffmpeg-alpine-${FFMPEG_ARCH:-x86_64}.tar.gz \
&& curl -SL https://github.com/homebridge/ffmpeg-for-homebridge/releases/latest/download/ffmpeg-alpine-${FFMPEG_ARCH}.tar.gz \
| tar xzf - -C . \
&& curl -SL https://github.com/bluenviron/mediamtx/releases/download/v${MTX_TAG}/mediamtx_v${MTX_TAG}_linux_${MTX_ARCH:-amd64}.tar.gz \
&& curl -SL https://github.com/bluenviron/mediamtx/releases/download/v${MTX_TAG}/mediamtx_v${MTX_TAG}_linux_${MTX_ARCH}.tar.gz \
| tar xzf - -C app \
&& cp app/${LIB_ARCH:-amd}.lib usr/local/lib/libIOTCAPIs_ALL.so \
&& rm app/*.txt app/*.lib \
&& cp app/lib.${LIB_ARCH} usr/local/lib/libIOTCAPIs_ALL.so \
&& rm app/*.txt app/lib.* \
&& echo BUILD_DATE=$(date) > .build_date


Expand Down
6 changes: 3 additions & 3 deletions app/Dockerfile.hwaccel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Use the build args QSV=1 to build with intel drivers.
ARG BUILD
ARG QSV
FROM amd64/python:3.11-slim-bookworm as base
FROM amd64/python:3.12-slim-bookworm as base

FROM base as builder
ARG QSV
Expand All @@ -20,9 +20,9 @@ RUN cd /build \
| tar -Jxf - --strip-components=1 -C usr/local --wildcards '*ffmpeg' \
&& curl -SL https://github.com/bluenviron/mediamtx/releases/download/v${MTX_TAG}/mediamtx_v${MTX_TAG}_linux_amd64.tar.gz \
| tar -xzf - -C app --wildcards 'mediamtx*' \
&& cp app/amd.lib usr/local/lib/libIOTCAPIs_ALL.so \
&& cp app/lib.amd64 usr/local/lib/libIOTCAPIs_ALL.so \
&& if [ -n "$QSV" ]; then cp -R /usr/lib/x86_64-linux-gnu/ usr/lib/; fi \
&& rm app/*.txt app/*.lib \
&& rm app/*.txt app/lib.* \
&& echo BUILD_DATE=$(date) > .build_date

FROM base
Expand Down
31 changes: 17 additions & 14 deletions app/Dockerfile.multiarch
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
ARG BUILD
FROM amd64/python:3.11-slim-bookworm as base_amd64
FROM arm32v7/python:3.11-slim-bookworm as base_arm
ARG ARM=1
FROM base_arm AS base_arm64
FROM amd64/python:3.12-slim-bookworm as base_amd64
FROM arm32v7/python:3.12-slim-bookworm as base_arm
FROM arm64v8/python:3.12-slim-bookworm as base_arm64

FROM base_$TARGETARCH as builder
ARG ARM
ARG LIB_ARCH=${ARM:+arm}
ARG MTX_ARCH=${ARM:+armv7}
ARG FFMPEG_ARCH=${ARM:+arm32v7}
ARG TARGETARCH
RUN apt-get update \
&& apt-get install -y curl tar ${ARM:+gcc} \
&& apt-get install -y curl tar gcc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY . /build/app/
RUN pip3 install --disable-pip-version-check --prefix=/build/usr/local -r /build/app/requirements.txt
RUN cd /build \
RUN echo "BUILDING IMAGE FOR ${TARGETARCH}" && \
if [ "${TARGETARCH}" = "arm" ]; \
then FFMPEG_ARCH=arm32v7; MTX_ARCH=armv7; \
elif [ "${TARGETARCH}" = "arm64" ]; \
then FFMPEG_ARCH=aarch64; MTX_ARCH=arm64v8; \
else FFMPEG_ARCH=x86_64; MTX_ARCH=amd64; \
fi && \
cd /build \
&& . app/.env \
&& mkdir -p tokens img \
&& curl -SL https://github.com/homebridge/ffmpeg-for-homebridge/releases/latest/download/ffmpeg-alpine-${FFMPEG_ARCH:-x86_64}.tar.gz \
&& curl -SL https://github.com/homebridge/ffmpeg-for-homebridge/releases/latest/download/ffmpeg-alpine-${FFMPEG_ARCH}.tar.gz \
| tar xzf - -C . \
&& curl -SL https://github.com/bluenviron/mediamtx/releases/download/v${MTX_TAG}/mediamtx_v${MTX_TAG}_linux_${MTX_ARCH:-amd64}.tar.gz \
&& curl -SL https://github.com/bluenviron/mediamtx/releases/download/v${MTX_TAG}/mediamtx_v${MTX_TAG}_linux_${MTX_ARCH}.tar.gz \
| tar xzf - -C app \
&& cp app/${LIB_ARCH:-amd}.lib usr/local/lib/libIOTCAPIs_ALL.so \
&& rm app/*.txt app/*.lib \
&& cp app/lib.${TARGETARCH} usr/local/lib/libIOTCAPIs_ALL.so \
&& rm app/*.txt app/lib.* \
&& echo BUILD_DATE=$(date) > .build_date

FROM base_$TARGETARCH
Expand Down
6 changes: 3 additions & 3 deletions app/Dockerfile.qsv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG BUILD
ARG QSV=1
FROM amd64/python:3.11-slim-bookworm as base
FROM amd64/python:3.12-slim-bookworm as base

FROM base as builder
ARG QSV
Expand All @@ -20,9 +20,9 @@ RUN cd /build \
| tar xzf - -C . \
&& curl -SL https://github.com/bluenviron/mediamtx/releases/download/v${MTX_TAG}/mediamtx_v${MTX_TAG}_linux_amd64.tar.gz \
| tar -xzf - -C app --wildcards 'mediamtx*' \
&& cp app/amd.lib usr/local/lib/libIOTCAPIs_ALL.so \
&& cp app/lib.amd64 usr/local/lib/libIOTCAPIs_ALL.so \
&& if [ -n "$QSV" ]; then cp -R /usr/lib/x86_64-linux-gnu/ usr/lib/ && cp -R /usr/bin/ usr/bin; fi \
&& rm app/*.txt app/*.lib \
&& rm app/*.txt app/lib.* \
&& echo BUILD_DATE=$(date) > .build_date

FROM base
Expand Down
21 changes: 5 additions & 16 deletions app/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
"url": "https://github.com/mrlt8/docker-wyze-bridge",
"image": "mrlt8/wyze-bridge",
"version": "2.5.3",
"arch": [
"armv7",
"aarch64",
"amd64"
],
"arch": ["armv7", "aarch64", "amd64"],
"startup": "application",
"boot": "auto",
"apparmor": false,
Expand All @@ -34,14 +30,8 @@
"IMG_DIR": "media/wyze/img/",
"RECORD_PATH": "media/wyze/{CAM_NAME}"
},
"map": [
"config:rw",
"media:rw",
"ssl:ro"
],
"services": [
"mqtt:want"
],
"map": ["config:rw", "media:rw", "ssl:ro"],
"services": ["mqtt:want"],
"ingress": true,
"ingress_port": 5000,
"panel_icon": "mdi:bridge",
Expand Down Expand Up @@ -92,6 +82,7 @@
"MQTT_AUTH": "str?",
"MQTT_TOPIC": "str?",
"MQTT_DTOPIC": "str?",
"MQTT_RETRIES": "int?",
"FILTER_NAMES": "str?",
"FILTER_MODELS": "str?",
"FILTER_MACS": "str?",
Expand Down Expand Up @@ -137,9 +128,7 @@
"MOTION_WEBHOOKS": "str?"
}
],
"MEDIAMTX": [
"match(^\\w+=.*)?"
],
"MEDIAMTX": ["match(^\\w+=.*)?"],
"WB_HLS_URL": "str?",
"WB_RTMP_URL": "str?",
"WB_RTSP_URL": "str?",
Expand Down
File renamed without changes.
File renamed without changes.
Binary file added app/lib.arm64
Binary file not shown.

0 comments on commit 1c76882

Please sign in to comment.