This is simple REST service daemon, which allows access camera on Raspberry PI devices remotely.
- Supported RPi devices: Raspberry Pi Zero WH, 2, 3, 4.
- Camera modules:
- Raspberry Pi Camera Module v2.
- Raspberry Pi NoIR Camera v2.
- Waveshare Camera Modules.
- Waveshare Camera Scheduler.
- Install Raspberry Pi OS Lite 2021-05-28
- Enable camera using
sudo raspi-config
- Install software dependencies
sudo apt install python-picamera python3-picamera sudo apt install python3-pip pip3 install RPi.GPIO
- Copy files on Raspberry Pi device into directory
/opt/camera
- Edit configuration file
camera-rest.json
, set http listening port, user credentials, camera resolutions and default settings. - Install and enable
camera-rest
as systemd service.sudo cp camera-rest.service /etc/systemd/system/ sudo chown root:root /etc/systemd/system/camera-rest.service sudo systemctl daemon-reload sudo systemctl enable camera-rest
- Start | Stop
camera-rest
service.sudo systemctl start camera-rest sudo systemctl stop camera-rest sudo systemctl status camera-rest
-
HTTP basic authentication is required.
-
Get info about RPi Camera device.
GET/system/info
curl -u client-001:ex4oo \ http://<ip-address>:<port>/system/info
-
Get current configuration
GET/system/config
curl -u client-001:ex4oo \ http://<ip-address>:<port>/system/config
-
Set camera capture configuration
POST/system/config
Supported config parametersparameter type default description resolution string "R1" enum, "R1", R2", "R3", ... rotation int 0 enum, degrees "D0", "D90", "D180", "D270" framerate int 24 framerate curl -u client-001:ex4oo \ --request POST \ --url http://<ip-address>:<port>/system/config \ --header 'Content-Type: application/json' \ --data '{ "resolution": "R1", "rotation": "D180", "framerate": 24 }'
-
Select connected camera for capture. This endpoint is only effective if camera controller uses hardware Camera Scheduler. Supported camera indexes: 0, 1.
POST/system/camera
curl -u client-001:ex4oo \ --request POST \ --url http://<ip-address>:<port>/system/camera \ --header 'Content-Type: application/json' \ --data '{ "camera": 1 }'
-
Get connected camera for capture.
GET/system/camera
curl -u client-001:ex4oo \ http://<ip-address>:<port>/system/camera
-
Get available camera resolutions.
GET/system/resolutions
curl -u client-001:ex4oo \ http://<ip-address>:<port>/system/resolutions
-
Get available camera rotations.
GET/system/rotations
curl -u client-001:ex4oo \ http://<ip-address>:<port>/system/resolutions
-
Capture single image and download it as attachment.
GET/system/capture
curl -u client-001:ex4oo \ http://<ip-address>:<port>/system/capture --output snapshot.jpg
-
Capture video stream and download it as attachment.
GET/system/stream.mjpg
curl -u client-001:ex4oo \ http://<ip-address>:<port>/system/stream.mjpg --output video.mjpg
Enjoy !