I have some difficulties to stop the raspivid function. I am trying ta start/stop recordings from the GPIO with a button. According to the following code, start the video recording works perfectly but impossible to stop it.
I have tried to use popen.kill(), popen.terminate(), subprocess.cal('pkill raspivid', shell=True), ... but nothing works
I would appreciate some help.
Code: Select all
import RPi.GPIO as GPIO import subprocess GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.IN, pull_up_down = GPIO.PUD_DOWN) while True: GPIO.wait_for_edge(17, GPIO.RISING) print("RecordingVideo") subprocess.call('raspivid -w 640 -h 480 -fps 90 -t 9999 -o slowmotion.h264') GPIO.wait_for_edge(17, GPIO.RISING) print("Stopped") subprocess.call('pkill raspivid') GPIO.cleanup()
Thank you in advance,