test using mjpg_streamer for webcam

workspace
Brendan Howell 8 years ago
parent b52c07322c
commit bbf7b8283d

@ -1,5 +1,8 @@
import os
import subprocess
import shutil
import tempfile
import time
try:
from pyA20.gpio import gpio, port
@ -57,9 +60,20 @@ class Photography(Bureau):
#cmd2 = "fswebcam --jpeg 95 --no-banner --resolution 1920x1080 "
#cmd2 += "-F 2 -S 1" + tmpimg.name
#cmd1 = "uvccapture -d/dev/video1 -x320 -y240 -o /dev/null"
cmd2 = "uvccapture -d/dev/video1 -D2 -m -x3264 -y2448 -o" + tmpimg.name
#cmd2 = "/usr/local/bin/uvccapture -m -x3264 -y2448 -o" + tmpimg.name
#subprocess.check_output(cmd1.split())
subprocess.check_output(cmd2.split())
cmd = "../../lib/mjpg_streamer -i 'input_uvc.so -r 3264x2448 -n' -o 'output_file.so -f /tmp/webcam -d 500 -s 1'"
proc = subprocess.Popen(cmd.split())
# copy last image to the tmpfile
filelist = os.listdir()
newest = max(filelist, key=lambda x: os.stat(x).st_mtime)
shutil.copyfile(newest, tmpimg.name)
time.sleep(2)
proc.terminate()
self._doc_light_off()
return {"photo": tmpimg.name}

Loading…
Cancel
Save