Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make redis-buffer and docker-compose
- Loading branch information
Showing
5 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
version: '3' | ||
services: | ||
stream-web: | ||
image: "streamapp" | ||
restart: "always" | ||
ports: | ||
- "5000:5000" | ||
command: "python3 app.py" | ||
links: | ||
- "redis:redis" | ||
stream-buffer: | ||
image: "streamapp" | ||
command: "python3 webcam.py" | ||
restart: "always" | ||
volumes: | ||
- "/dev:/dev" | ||
- "/root/streamapp:/streamapp" | ||
privileged: true | ||
links: | ||
- "redis:redis" | ||
redis: | ||
image: redis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import cv2 | ||
import numpy | ||
import socket | ||
from sys import getsizeof | ||
import pickle | ||
import struct | ||
import time | ||
import redis | ||
|
||
|
||
|
||
cap = cv2.VideoCapture('rtsp://192.168.0.107:554/11') | ||
r = redis.StrictRedis(host='redis', port=6379, db=0) | ||
n_frames = 0 | ||
start = time.time() | ||
while True: | ||
_, f = cap.read() | ||
n_frames += 1 | ||
r.set('img', pickle.dumps(f)) | ||
if n_frames % 10 == 0: | ||
print(n_frames / (time.time() - start)) | ||
n_frames = 0 | ||
start = time.time() | ||
|