Browse Source

Add pi and ingest scripts

master
Justin Forsyth 1 month ago
parent
commit
1d57e979a3
Signed by: justin GPG Key ID: 86AE5A8E7F21CDF7
8 changed files with 34 additions and 2 deletions
  1. +2
    -1
      .env.example
  2. +3
    -1
      .gitignore
  3. +1
    -0
      ingest.sh
  4. +22
    -0
      lilytv/server/server.py
  5. +1
    -0
      pi.sh
  6. +1
    -0
      play.sh
  7. +4
    -0
      requirements.txt
  8. +0
    -0
      video/.gitkeep

+ 2
- 1
.env.example View File

@ -1,2 +1,3 @@
export SERVER_URL=192.168.1.2
export SERVER_PORT=8000
export SERVER_PORT=8000
export READTHEDOCS=True

+ 3
- 1
.gitignore View File

@ -1,3 +1,5 @@
.env
.idea
venv
venv
video/*.mp4
video/*.h264

+ 1
- 0
ingest.sh View File

@ -0,0 +1 @@
nc -l 2222 > video/in.h264

+ 22
- 0
lilytv/server/server.py View File

@ -0,0 +1,22 @@
import cv2
cap = cv2.VideoCapture('video/in.h264')
# Define the codec and create VideoWriter object
fourcc = cv2.VideoWriter_fourcc(*'MP4V')
out = cv2.VideoWriter('video/out.mp4', fourcc, 30.0, (1920, 1080))
while cap.isOpened():
ret, frame = cap.read()
if not ret:
print("Can't receive frame (stream end?). Exiting ...")
break
# TODO analyze here
frame = cv2.flip(frame, 0)
# write the modified frame
out.write(frame)
cv2.imshow('frame', frame)
if cv2.waitKey(1) == ord('q'):
break
# Release everything if job is finished
cap.release()
out.release()
cv2.destroyAllWindows()

+ 1
- 0
pi.sh View File

@ -0,0 +1 @@
raspivid -t 0 -w 1920 -h 1080 -hf -fps 30 -o - | nc "$SERVER_URL" 2222

+ 1
- 0
play.sh View File

@ -0,0 +1 @@
mplayer video/in.h264 -fps 30 -demuxer h264es

+ 4
- 0
requirements.txt View File

@ -1 +1,5 @@
numpy==1.20.1
opencv-python==4.5.1.48
picamera==1.13
Pillow==8.1.1
python-dotenv==0.15.0

lilytv/pi/__init__.py → video/.gitkeep View File


Loading…
Cancel
Save