The storage server is the heartbeat of Chimera. It handles 4 main sections regarding file storage:
- Motion detection to save images from cameras ◀
- Convert and generate videos and archives for download ◀
- Handling file deletion, metrics, and stats ◀
- Serving all of the files mentioned above ◀
Because storage requires files generated by motion, it's best to have storage running on same machine with motion. (Although theoretically you could use a network drive, but dubious performance would ensue.)
Motion config should save pictures from RTSP camera and have at the very least:
picture_type jpeg
picture_filename %t/%Y%m%d-%H%M%S-%q
on_picture_save psql -c "COPY frame_files(timestamp, camera, name, size) FROM PROGRAM 'echo %Y-%m-%d %T,%t,%Y%m%d-%H%M%S-%q.jpg,$(wc -c %f | head -n1 | awk '{print $1;}')' WITH DELIMITER ',';"
The rest of the config in terms of motion is up to you and your security needs.
ffmpeg is also required for generating videos.
Type | Route | Description | Parameters | Returns |
---|---|---|---|---|
GET | /status |
Type | Route | Description | Parameters | Returns |
---|---|---|---|---|
POST | /createVideo | Creates videos from images based on timestamps | { camera: Number, fps: Number, save: Boolean, start: Date or YYYYMMDD-HHMMSS, end: Date or YYYYMMDD-HHMMSS, skip: Number } |
{ id: String, url: String, frameLimitMet: Boolean } |
POST | /listFramesVideo | Sends a list of links to images for scrubbing | { camera: Number, start: Date or YYYYMMDD-HHMMSS, end: Date or YYYYMMDD-HHMMSS, frames: Number } |
{ list: [ String ] } |
POST | /createZip | Creates zip archive from images based on timestamps | { camera: Number, save: Boolean, start: Date or YYYYMMDD-HHMMSS, end: Date or YYYYMMDD-HHMMSS, skip: Number } |
{ id: String, url: String, frameLimitMet: Boolean } |
POST | /statusProcess | Get status of video or zip process | { id: String } |
{ running: Boolean, id: String } |
POST | /cancelProcess | Cancel running video or zip process | { id: String } |
{ cancelled: Boolean, id: String } |
GET | /listProcess | Get list of all processes | None | { list: [ ProcessObj ] } |
POST | /deleteProcess | Delete video or zip by given ID | { id: String } |
{ deleted: Boolean, id: String } |
// fileName = output_[cameraNumber]_[startDateTime]_[endDateTime]_[ID].[type]
// id = [RandomAlphaNumeric]-[requestDateTime]
// dateTime = YYYYMMDD-hhmmss (0-23 hour clock)
//ProcessObj
{
link: String // /shared/captures/[fileName]
type: String // mp4, zip, etc
id: String, // id
requested: String, //dateTime
camera: Number,
start: String, // dateTime,
end: String, //dateTime,
running: Boolean
}
Type | Route | Description | Parameters | Returns |
---|---|---|---|---|
POST | /pathStats | Gets addition stats | ||
POST | /pathSize | Gets folder or file size | { camera: Number } |
{ size: String } |
POST | /pathFileCount | Gets folder's file count | { camera: Number } |
{ count: Number } |
POST | /pathMetrics | |||
POST | /pathDelete | Delete folder or file by path | { camera: Number } |
{ deleted: Boolean } |
POST | /pathClean | Deletes older files or files in directory given a number of days | { camera: Number, days: Number } |
{ deleted: Boolean } |
Type | Route | Description | Parameters | Returns |
---|---|---|---|---|
GET | /directory/example.mp4 | Downloads the specified file | None | mp4 |
Type | Route | Description | Parameters | Returns |
---|---|---|---|---|
GET | /health | Confirms server alive | N/A | N/A |