This document describes the APIs and endpoints available in the Pi Camera Streaming system.
| Endpoint | Protocol | Description |
|---|---|---|
/ |
HTTP | Main web interface |
/live/cam.flv |
HTTP-FLV | Direct FLV stream |
/rtc/v1/play/ |
WebRTC | WebRTC streaming API |
POST http://[PI_IP]:1985/rtc/v1/play/
Content-Type: application/json
{
"api": "http://[PI_IP]:1985/rtc/v1/play/",
"streamurl": "webrtc://[PI_IP]/live/cam",
"sdp": "[SDP_OFFER]"
}Response:
{
"code": 0,
"sdp": "[SDP_ANSWER]"
}GET http://[PI_IP]:1985/api/v1/streams/Response:
{
"code": 0,
"server": "vid-446h329",
"service": "19r0m513",
"pid": "1",
"streams": [
{
"id": "vid-ii671sl",
"name": "cam",
"vhost": "vid-xn5qd67",
"app": "live",
"tcUrl": "rtmp://[PI_IP]:1935/live",
"url": "/live/cam",
"live_ms": 1756925547701,
"clients": 1,
"frames": 7211,
"send_bytes": 4292,
"recv_bytes": 186355594,
"kbps": {
"recv_30s": 11894,
"send_30s": 0
},
"publish": {
"active": true,
"cid": "8j822yz7"
},
"video": {
"codec": "H264",
"profile": "High",
"level": "4.1",
"width": 1280,
"height": 720
},
"audio": null
}
]
}GET http://[PI_IP]:1985/api/v1/streams/[STREAM_ID]GET http://[PI_IP]:1985/api/v1/summariesThe start-camera.sh script accepts the following parameters:
| Option | Description | Example |
|---|---|---|
--profile |
Use predefined performance profile | --profile day |
--width |
Set video width | --width 1920 |
--height |
Set video height | --height 1080 |
--fps |
Set framerate | --fps 30 |
--bitrate |
Set bitrate in bps | --bitrate 8000000 |
--gop |
Set GOP size | --gop 60 |
--verbose |
Enable verbose logging | --verbose |
| Variable | Default | Description |
|---|---|---|
STREAM_NAME |
cam |
Stream identifier |
CAMERA_WIDTH |
1280 |
Video width |
CAMERA_HEIGHT |
720 |
Video height |
CAMERA_FPS |
30 |
Frames per second |
CAMERA_BITRATE |
6000000 |
Bitrate in bps |
GOP_SIZE |
60 |
GOP size in frames |
SRS_HOST |
localhost |
SRS server hostname |
SRS_PORT |
1935 |
SRS server port |
./scripts/start-camera.sh --profile day- Resolution: 1920×1080
- Framerate: 25 fps
- Bitrate: 8 Mbps
- GOP: 120 frames
./scripts/start-camera.sh --profile night- Resolution: 1280×720
- Framerate: 30 fps
- Bitrate: 4 Mbps
- GOP: 60 frames
./scripts/start-camera.sh --profile low-latency- Resolution: 1280×720
- Framerate: 60 fps
- Bitrate: 6 Mbps
- GOP: 30 frames
docker compose up -ddocker compose downdocker compose restart# All services
docker compose logs -f
# Specific service
docker compose logs -f srs
docker compose logs -f cam-viewerdocker compose ps- Port: 1935 (RTMP), 1985 (API), 8081 (HTTP)
- Image:
ossrs/srs:5 - Config:
config/srs.conf
- Port: 80 (HTTP)
- Image:
nginx:alpine - Config:
config/nginx.conf
const iceServers = [
{ urls: 'stun:stun.l.google.com:19302' },
{ urls: 'stun:stun1.l.google.com:19302' }
];- Protocol: WebRTC
- Codec: H.264
- Transport: UDP
- ICE: STUN servers configured
GET http://[PI_IP]:1985/api/v1/summariesGET http://[PI_IP]:1985/api/v1/streams/GET http://[PI_IP]/- Frames: Total frames processed
- Bytes: Data transferred
- Kbps: Bandwidth usage
- Clients: Active connections
- Latency: Stream delay
- CPU Usage: Process utilization
- Memory: RAM consumption
- Network: Bandwidth utilization
- Temperature: System temperature
./scripts/test-setup.sh# Test FLV stream
curl -I http://[PI_IP]:8081/live/cam.flv
# Test WebRTC API
curl -X POST http://[PI_IP]:1985/rtc/v1/play/ \
-H "Content-Type: application/json" \
-d '{"api":"http://[PI_IP]:1985/rtc/v1/play/","streamurl":"webrtc://[PI_IP]/live/cam","sdp":"test"}'./scripts/start-camera.sh --verbose# Docker logs
docker compose logs -f
# System logs
sudo journalctl -u pi-camera-streaming -f
# Camera logs
dmesg | grep -i camera| Code | Description |
|---|---|
| 0 | Success |
| 400 | Bad Request |
| 404 | Not Found |
| 500 | Internal Server Error |
{
"code": 404,
"message": "Stream not found"
}{
"code": 500,
"message": "Internal server error"
}For more information, refer to the main README.md or create an issue on GitHub.