Skip to content

Commit 7078448

Browse files
committed
Added example documentation, upgrade of Dockerfile with inmemory buffer methods, fixed bugs on start.sh script
1 parent d2f46f3 commit 7078448

File tree

6 files changed

+40
-19
lines changed

6 files changed

+40
-19
lines changed

README.md

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Copy and paste `docker-compose.yml` to folder of your choice (recommended to be
110110
version: '3.8'
111111
services:
112112
chrysedgeportal:
113-
image: chryscloud/chrysedgeportal:0.0.6
113+
image: chryscloud/chrysedgeportal:0.0.7
114114
depends_on:
115115
- chrysedgeserver
116116
- redis
@@ -119,7 +119,7 @@ services:
119119
networks:
120120
- chrysnet
121121
chrysedgeserver:
122-
image: chryscloud/chrysedgeserver:0.0.6
122+
image: chryscloud/chrysedgeserver:0.0.7
123123
restart: always
124124
depends_on:
125125
- redis
@@ -287,6 +287,26 @@ Run example to turn storage off for camera `test`:
287287
python storage_onoff.py --device test --on false
288288
```
289289

290+
### Running `opencv_inmemory_display.py`
291+
292+
Prerequsite to have an in-memory queue is to setup `buffer -> in_memory` value in `conf.yaml` of your custom config.
293+
294+
This setting stores compressed video stream in memory and enables you to query the complete queue or portion of it. It also allows you to query the same queue (`timestamp_from` and `timestamp_to`) from parallel subprocess (check `examples/opencv_inmemory_display_advanced.py` for an example).
295+
296+
Wait for X amount of time for in-memory queue to fill up then run (for added camera named `test`):
297+
```
298+
python opencv_inmemory_display.py --device test
299+
```
300+
301+
### Running `video_probe.py`
302+
303+
This example shows gow to query local system time and retrieve information about the incoming video for specific camera/device.
304+
305+
Run example to probe a video stream (for added camera named `test`):
306+
```
307+
python video_probe.py --device tet
308+
```
309+
290310
# Custom configuration
291311

292312
## Custom redis configuration
@@ -311,7 +331,7 @@ Modify folders accordingly for **Mac OS X and Windows**
311331
Create `conf.yaml` file in `/data/chrysalis` folder. The configuration file is automatically picked up if it exists otherwise system fallbacks to it's default configuration.
312332

313333
```yaml
314-
version: 0.0.3
334+
version: 0.0.7
315335
title: Chrysalis Video Edge Proxy
316336
description: Chrysalis Video Edge Proxy Service for Computer Vision
317337
mode: release # "debug": or "release"
@@ -332,6 +352,7 @@ annotation:
332352

333353
buffer:
334354
in_memory: 1 # number of images to store in memory buffer (1 = default)
355+
in_memory_scale: "-1:-1" # scaling of the images. Examples: 400:-1 (keeps aspect radio with width 400), 400:300, iw/3:ih/3, ...)
335356
on_disk: false # store key-frame separated mp4 file segments to disk
336357
on_disk_folder: /data/chrysalis/archive # can be any custom folder you'd like to store video segments to
337358
on_disk_clean_older_than: "5m" # remove older mp4 segments than 5m
@@ -347,10 +368,10 @@ buffer:
347368
- `annotation -> poll_duration_ms`: poll every x miliseconds for batching purposes (default: 300ms)
348369
- `annotation -> max_match_size`: maximum number of annotation per batch size (default: 299)
349370
- `buffer -> in_memory`: number of decoded frames to store in memory per camera (default: 1)
371+
- `buffer -> in_memory_scale`: rescaling decoded images in memory buffer (default: `-1:-1`). Check [FFmpeg Scaling](https://trac.ffmpeg.org/wiki/Scaling)
350372
- `on_disk`: true/false, store key-frame chunked mp4 files to disk (default: false)
351373
- `on_disk_folder`: path to the folder where segments will be stored
352374
- `on_disk_clean_older_than`: remove mp4 segments older than (default: 5m)
353-
- `on_disk_schedule`: run disk cleanup scheduler cron job [#https://en.wikipedia.org/wiki/Cron](https://en.wikipedia.org/wiki/Cron)
354375

355376
`on_disk` creates mp4 segments in format: `"current_timestamp in ms"_"duration_in_ms".mp4`. For example: `1600685088000_2000.mp4`
356377

@@ -391,12 +412,12 @@ docker-compose build
391412
- [X] Add API key to Chrysalis Cloud for enable/disable storage
392413
- [X] Add configuration for in memory buffer pool of decoded image so they can be queried in the past
393414
- [X] Configuration and a cron job to store mp4 segments (1 per key-frame) from cameras and a cron job to clean old mp4 segments (rotating file buffer)
394-
- [ ] Add gRPC API to query in-memory buffer of images
415+
- [X] Add gRPC API to query in-memory buffer of images
395416
- [ ] Remote access Security (grpc TLS Client Authentication)
396417
- [ ] Remote access Security (TLS Client Authentication for web interface)
397418
- [ ] add RTMP container support (mutliple streams, same treatment as RTSP cams)
398419
- [ ] add v4l2 container support (e.g. Jetson Nano, Raspberry Pi?)
399-
- [ ] Initial web screen to pull images (RTSP, RTMP, V4l2)
420+
- [X] Initial web screen to pull images (RTSP, RTMP, V4l2)
400421
- [ ] Benchmark NVDEC,NVENC, VAAPI hardware decoders
401422

402423
# Contributing
@@ -405,7 +426,7 @@ Please read `CONTRIBUTING.md` for details on our code of conduct, and the proces
405426

406427
# Versioning
407428

408-
Current version is initial release - v0.0.1 prerelease
429+
Current version is initial release - v0.0.7 prerelease
409430

410431
# Authors
411432

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3.8'
22
services:
33
chrysedgeportal:
4-
image: chryscloud/chrysedgeportal:0.0.6
4+
image: chryscloud/chrysedgeportal:0.0.7
55
build: web/
66
depends_on:
77
- chrysedgeserver
@@ -11,7 +11,7 @@ services:
1111
networks:
1212
- chrysnet
1313
chrysedgeserver:
14-
image: chryscloud/chrysedgeserver:0.0.6
14+
image: chryscloud/chrysedgeserver:0.0.7
1515
build: server/
1616
restart: always
1717
depends_on:

examples/opencv_inmemory_display_advanced.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ def video_process(queue, device,ts_from, ts_to, grpc_channel, process_number):
6161

6262
img_count += 1
6363

64-
# queue.put({"img":re_img, "process": process_number})
64+
queue.put({"img":re_img, "process": process_number})
6565
print("image count: ", img_count)
6666

67-
# queue.put({"is_end":True, "process":process_number})
67+
queue.put({"is_end":True, "process":process_number})
6868

6969
# debug function, checkin if dislay smooth and looks fastforwarded without any glitches
7070
def display(num_processes):
@@ -133,7 +133,7 @@ def display(num_processes):
133133
for p in processes:
134134
p.start()
135135

136-
# display(len(processes))
136+
display(len(processes))
137137

138138
for p in processes:
139139
p.join()

python/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ RUN conda env create -f environment.yml
3030

3131
RUN mkdir /proto
3232
COPY proto/ /proto/
33-
COPY rtsp_to_rtmp.py start.sh global_vars.py read_image.py archive.py disk_cleanup.py /
33+
COPY rtsp_to_rtmp.py start.sh global_vars.py read_image.py archive.py disk_cleanup.py inmemory_buffer.py /
3434

3535
RUN chmod +x /start.sh
3636

python/start.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ fi
3535
if [ ! -z "$in_memory_buffer" ]; then
3636
cmd="$cmd --memory_buffer $in_memory_buffer"
3737
fi
38-
if [ ! -z "$in_memory_scame" ]; then
39-
cmd="$cmd --memory_scale $in_memory_buffer"
38+
if [ ! -z "$in_memory_scale" ]; then
39+
cmd="$cmd --memory_scale $in_memory_scale"
4040
fi
4141
if [ ! -z "$disk_buffer_path" ]; then
4242
cmd="$cmd --disk_path $disk_buffer_path"

server/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ import (
3636
)
3737

3838
var (
39-
grpcServer *grpc.Server
40-
grpcConn net.Listener
41-
// defaultDBPath = "/data/chrysalis"
42-
defaultDBPath = "/home/igor/Downloads"
39+
grpcServer *grpc.Server
40+
grpcConn net.Listener
41+
defaultDBPath = "/data/chrysalis"
42+
// defaultDBPath = "/home/igor/Downloads"
4343
)
4444

4545
func main() {

0 commit comments

Comments
 (0)