Created
June 5, 2019 17:53
-
-
Save russfeld/97e824294cb4c67d6722c4eefc0c41e3 to your computer and use it in GitHub Desktop.
Very simple Python program to control the picam-stream script. Helpful for scripting the livestream. See https://gist.github.com/russfeld/0878b1f8eaf7409136b9125ce5e1458f
This file contains hidden or 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
import subprocess | |
import time | |
import os | |
import signal | |
# Some trigger condition to start stream | |
process = subprocess.Popen("/home/pi/picam-stream.sh", preexec_fn=os.setsid, shell=True) | |
# Wait for some condition to stop stream | |
time.sleep(15) | |
# Stop Stream | |
os.killpg(os.getpgid(process.pid), signal.SIGTERM) | |
print("Done") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment