Awesome
mediamtx-rpicamera
Raspberry Pi Camera component for MediaMTX.
This is a C-based executable that pulls the Raspberry Camera video feed, encodes it and makes the compressed video available to the server, while listening for incoming commands.
This is embedded into all MediaMTX releases and shouldn't normally be downloaded unless you want to recompile it.
Compile
-
You must be on a Raspberry Pi, running Raspberry Pi OS Bullseye
-
Install build dependencies:
sudo apt install -y \ g++ \ xxd \ wget \ git \ cmake \ meson \ pkg-config \ python3-jinja2 \ python3-yaml \ python3-ply
-
Build:
meson setup build && DESTDIR=./prefix ninja -C build install
This will produce the
build/mtxrpicam_32
orbuild/mtxrpicam_64
folder (depending on the architecture).
Compile against an external libcamera
-
You must be on a Raspberry Pi, running Raspberry Pi OS Bullseye
-
Install build dependencies:
sudo apt install -y \ g++ \ xxd \ wget \ git \ cmake \ meson \ pkg-config \ python3-jinja2 \ python3-yaml \ python3-ply
-
Make sure that the development package of your libcamera is installed, otherwise install the default one:
sudo apt install -y \ libcamera-dev
-
Build with
--wrap-mode=default
(that disables embedded libraries):meson setup --wrap-mode=default build && DESTDIR=./prefix ninja -C build install
This will produce the
build/mtxrpicam_32
orbuild/mtxrpicam_64
folder (depending on the architecture).
Cross-compile
-
You can be on any machine you like
-
Install Docker and
make
-
Build for every supported architecture:
make -f utils.mk build
This will produce the
build/mtxrpicam_32
andbuild/mtxrpicam_64
folders.
Install
-
Download MediaMTX source code and open a terminal in it
-
Run
go generate ./...
-
Copy
build/mtxrpicam_32
and/orbuild/mtxrpicam_64
insideinternal/staticsources/rpicamera/
, overriding existing folders -
Compile MediaMTX
go build .
License
All the code in this repository is released under the MIT License. Compiled binaries make use of some third-party dependencies:
- libcamera, released under the MIT license
- freetype, released under the FreeType license
- x264, released under the GPL v2