Go (Golang) wrapper for rpicam-vid (Raspberry Pi Video Capture Application) with stream demultiplexer and HTTP server.
The demultiplexer allows multiple concurrent stream consumers from a single rpicam-vid process.
This implementation produces a MJPEG image stream.
git clone https://github.com/cleroux/go-rpicamvid.git
cd go-rpicamvid
make
./rpicamvid-server
Open video stream in browser at http://localhost:8080
stream, err := r.Start()
if err != nil {
fmt.Printf("Failed to start camera: %v\n", err)
return
}
defer stream.Close()
for {
jpegBytes, err := stream.GetFrame()
if err != nil {
fmt.Printf("Failed to get camera frame: %v\n", err)
continue
}
// TODO: Do something with the JPEG frame
}
See cmd/server/main.go for a complete example.