Skip to content

Latest commit

 

History

History
63 lines (40 loc) · 2.21 KB

README.md

File metadata and controls

63 lines (40 loc) · 2.21 KB

motion-streamer

Building from sources

There is no binary distribution yet, so you will need to download this repository and compile the sources. I have not tested cross-compilation, so I currently install all dependencies in the RPi and compile there.

Also note that this was written based on my experience with the Raspberry Pi OS Bookworm, so in other operating systems your mileage may vary.

Required packages to compile

apt install libgirepository1.0-dev libgstreamer1.0-dev llvm libnuma-dev gstreamer1.0-opencv

Haskell compiler

While there is a package for ghc and cabal-install on Bookworm I had problems compiling under that version. The software was tested using GHC 9.8.2 and cabal 3.12.1.0. You can install from binary packages using GHCup. Once you install GHCup try the command ghcup tui for a neat terminal ui that will show you all compiler and tool versions available.

Compile and run the application

cabal run motion-streamer

In case you see the error motion-streamer: FactoryError it is probably due to the lack of a libcamerasrc element in your gstreamer instalation. To install libcamera on Raspberry Pi OS:

apt install gstreamer1.0-libcamera

To install libcamera from sources check their getting started section

You can still run without libcamera using a test pattern:

MS_TEST=true cabal run motion-streamer

You can also configure the host (defaults to "0.0.0.0") and port (defaults to 5000) for tcp video streaming:

MS_HOST=localhost MS_PORT=8080 cabal run motion-streamer

Using the camera

Once you have the camera setup, you can run the application without the MS_TEST flag.

Streaming the video captured by the camera

Unless you use the MS_HOST configuration, the camera will be streaming via TCP to all network interfaces. To watch the stream from any computer where rpi is a hostname that points to the RPi running motion-streamer use gstreamer-launch-1.0 (provided by the package gstreamer1.0-tools):

gst-launch-1.0 -v tcpclientsrc host=rpi port=5000 ! h264parse ! avdec_h264 ! autovideosink