mirror of
https://github.com/bluenviron/mediamtx
synced 2024-12-14 18:54:54 +00:00
rpicamera: allow to use the Raspberry Pi Camera with Docker (#1212)
This commit is contained in:
parent
ac8207c8f4
commit
4c96a6873e
@ -1,6 +1,5 @@
|
||||
# do not add .git, since it is needed to extract the tag
|
||||
|
||||
/tmp
|
||||
/binaries
|
||||
/coverage*.txt
|
||||
/apidocs/*.html
|
||||
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -66,6 +66,8 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- run: make binaries
|
||||
|
||||
- run: make dockerhub
|
||||
env:
|
||||
DOCKER_USER: ${{ secrets.DOCKER_USER }}
|
||||
|
28
README.md
28
README.md
@ -525,19 +525,15 @@ After starting the server, the webcam can be reached on `rtsp://localhost:8554/c
|
||||
|
||||
### From a Raspberry Pi Camera
|
||||
|
||||
_rtsp-simple-server_ natively support the Raspberry Pi Camera, enabling high-quality and low-latency video streaming from the camera to any user. To make the video stream of a Raspberry Pi Camera available on the server:
|
||||
_rtsp-simple-server_ natively support the Raspberry Pi Camera, enabling high-quality and low-latency video streaming from the camera to any user. There are a couple of requisites:
|
||||
|
||||
1. The server must be installed on a Raspberry Pi, with Raspberry Pi OS bullseye or newer as operative system, and must be installed by using the standard method (Docker is not actually supported). If you're using the 64-bit version of the operative system, you need to pick the `arm64` variant of the server.
|
||||
1. The server must run on a Raspberry Pi, with Raspberry Pi OS bullseye or newer as operative system.
|
||||
|
||||
2. Make sure that the legacy camera stack is disabled. Type:
|
||||
2. Make sure that the legacy camera stack is disabled. Type `sudo raspi-config`, then go to `Interfacing options`, `enable/disable legacy camera support`, choose `no`. Reboot the system.
|
||||
|
||||
```
|
||||
sudo raspi-config
|
||||
```
|
||||
3. Make sure that the `libcamera` version is at least `0.0.1`, otherwise upgrade it with `sudo apt upgrade`.
|
||||
|
||||
Then go to `Interfacing options`, `enable/disable legacy camera support`, choose `no`. Reboot the system.
|
||||
|
||||
3. edit `rtsp-simple-server.yml` and replace everything inside section `paths` with the following content:
|
||||
If you want to run the standard (non-dockerized) version of the server, just download the server executable and make sure to pick the `arm64` variant if you're using the 64-bit version of the operative system. Then edit `rtsp-simple-server.yml` and replace everything inside section `paths` with the following content:
|
||||
|
||||
```yml
|
||||
paths:
|
||||
@ -545,6 +541,20 @@ _rtsp-simple-server_ natively support the Raspberry Pi Camera, enabling high-qua
|
||||
source: rpiCamera
|
||||
```
|
||||
|
||||
If you want to run the server with Docker, you need to use the `--privileged` flag and expose some folders:
|
||||
|
||||
```
|
||||
docker run --rm -it \
|
||||
--network=host \
|
||||
--privileged \
|
||||
--tmpfs /dev/shm:exec \
|
||||
-v /usr:/usr:ro \
|
||||
-v /lib:/lib:ro \
|
||||
-v /run/udev:/run/udev:ro \
|
||||
-e RTSP_PATHS_CAM_SOURCE=rpiCamera \
|
||||
aler9/rtsp-simple-server
|
||||
```
|
||||
|
||||
After starting the server, the camera can be reached on `rtsp://raspberry-pi:8554/cam` or `http://raspberry-pi:8888/cam`.
|
||||
|
||||
Camera settings can be changed by using the `rpiCamera*` parameters:
|
||||
|
@ -1,18 +1,7 @@
|
||||
define DOCKERFILE_DOCKERHUB
|
||||
FROM --platform=linux/amd64 $(BASE_IMAGE) AS build
|
||||
RUN apk add --no-cache git
|
||||
WORKDIR /s
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . ./
|
||||
ARG VERSION
|
||||
ARG OPTS
|
||||
RUN export CGO_ENABLED=0 $${OPTS} \
|
||||
&& go build -ldflags "-X github.com/aler9/rtsp-simple-server/internal/core.version=$$VERSION" -o /rtsp-simple-server
|
||||
|
||||
FROM scratch
|
||||
COPY --from=build /rtsp-simple-server /
|
||||
COPY --from=build /s/rtsp-simple-server.yml /
|
||||
ARG BINARY
|
||||
ADD $$BINARY /
|
||||
ENTRYPOINT [ "/rtsp-simple-server" ]
|
||||
endef
|
||||
export DOCKERFILE_DOCKERHUB
|
||||
@ -27,34 +16,38 @@ dockerhub:
|
||||
rm -rf $$HOME/.docker/manifests/*
|
||||
docker buildx create --name=builder --use
|
||||
|
||||
echo "$$DOCKERFILE_DOCKERHUB" | docker buildx build . -f - --build-arg VERSION=$(VERSION) \
|
||||
--push -t aler9/rtsp-simple-server:$(VERSION)-amd64 --build-arg OPTS="GOOS=linux GOARCH=amd64" --platform=linux/amd64
|
||||
echo "$$DOCKERFILE_DOCKERHUB" | docker buildx build . -f - \
|
||||
--platform=linux/amd64 \
|
||||
--build-arg BINARY="$$(echo binaries/*linux_amd64.tar.gz)" \
|
||||
-t aler9/rtsp-simple-server:$(VERSION)-amd64 \
|
||||
-t aler9/rtsp-simple-server:latest-amd64 \
|
||||
--push
|
||||
|
||||
echo "$$DOCKERFILE_DOCKERHUB" | docker buildx build . -f - --build-arg VERSION=$(VERSION) \
|
||||
--push -t aler9/rtsp-simple-server:$(VERSION)-armv6 --build-arg OPTS="GOOS=linux GOARCH=arm GOARM=6" --platform=linux/arm/v6
|
||||
echo "$$DOCKERFILE_DOCKERHUB" | docker buildx build . -f - \
|
||||
--platform=linux/arm/v6 \
|
||||
--build-arg BINARY="$$(echo binaries/*linux_armv6.tar.gz)" \
|
||||
-t aler9/rtsp-simple-server:$(VERSION)-armv6 \
|
||||
-t aler9/rtsp-simple-server:latest-armv6 \
|
||||
--push
|
||||
|
||||
echo "$$DOCKERFILE_DOCKERHUB" | docker buildx build . -f - --build-arg VERSION=$(VERSION) \
|
||||
--push -t aler9/rtsp-simple-server:$(VERSION)-armv7 --build-arg OPTS="GOOS=linux GOARCH=arm GOARM=7" --platform=linux/arm/v7
|
||||
echo "$$DOCKERFILE_DOCKERHUB" | docker buildx build . -f - \
|
||||
--platform=linux/arm/v7 \
|
||||
--build-arg BINARY="$$(echo binaries/*linux_armv7.tar.gz)" \
|
||||
-t aler9/rtsp-simple-server:$(VERSION)-armv7 \
|
||||
-t aler9/rtsp-simple-server:latest-armv7 \
|
||||
--push
|
||||
|
||||
echo "$$DOCKERFILE_DOCKERHUB" | docker buildx build . -f - --build-arg VERSION=$(VERSION) \
|
||||
--push -t aler9/rtsp-simple-server:$(VERSION)-arm64v8 --build-arg OPTS="GOOS=linux GOARCH=arm64" --platform=linux/arm64/v8
|
||||
echo "$$DOCKERFILE_DOCKERHUB" | docker buildx build . -f - \
|
||||
--platform=linux/arm64/v8 \
|
||||
--build-arg BINARY="$$(echo binaries/*linux_arm64v8.tar.gz)" \
|
||||
-t aler9/rtsp-simple-server:$(VERSION)-arm64v8 \
|
||||
-t aler9/rtsp-simple-server:latest-arm64v8 \
|
||||
--push
|
||||
|
||||
docker manifest create aler9/rtsp-simple-server:$(VERSION) \
|
||||
$(foreach ARCH,amd64 armv6 armv7 arm64v8,aler9/rtsp-simple-server:$(VERSION)-$(ARCH))
|
||||
docker manifest push aler9/rtsp-simple-server:$(VERSION)
|
||||
|
||||
docker manifest create aler9/rtsp-simple-server:latest-amd64 aler9/rtsp-simple-server:$(VERSION)-amd64
|
||||
docker manifest push aler9/rtsp-simple-server:latest-amd64
|
||||
|
||||
docker manifest create aler9/rtsp-simple-server:latest-armv6 aler9/rtsp-simple-server:$(VERSION)-armv6
|
||||
docker manifest push aler9/rtsp-simple-server:latest-armv6
|
||||
|
||||
docker manifest create aler9/rtsp-simple-server:latest-armv7 aler9/rtsp-simple-server:$(VERSION)-armv7
|
||||
docker manifest push aler9/rtsp-simple-server:latest-armv7
|
||||
|
||||
docker manifest create aler9/rtsp-simple-server:latest-arm64v8 aler9/rtsp-simple-server:$(VERSION)-arm64v8
|
||||
docker manifest push aler9/rtsp-simple-server:latest-arm64v8
|
||||
|
||||
docker manifest create aler9/rtsp-simple-server:latest \
|
||||
$(foreach ARCH,amd64 armv6 armv7 arm64v8,aler9/rtsp-simple-server:$(VERSION)-$(ARCH))
|
||||
docker manifest push aler9/rtsp-simple-server:latest
|
||||
|
Loading…
Reference in New Issue
Block a user