import signal
def handler(signum, frame):
# вызовется при получении сигнала
signal.signal(signal.SIGINT, handler)
while (True):
time.sleep(1)
import os
import sys
import subprocess
import signal
cmd = "python3 b.py"
pro = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, preexec_fn=os.setsid)
os.killpg(os.getpgid(self.pro.pid), signal.SIGINT)
import gi
import sys
from gi.repository import Gst, GObject
Gst.init(sys.argv)
pipeline = Gst.parse_launch(
'nvarguscamerasrc gainrange="1 1" ispdigitalgainrange="2 2" ! '
'video/x-raw(memory:NVMM),width=1280, height=720, framerate=120/1, format=NV12 ! '
'omxh264enc ! qtmux ! filesink location=out/file1.mp4')
pipeline.set_state(Gst.State.PLAYING)
time.sleep(2)
pipeline.send_event(Gst.Event.new_eos())
pipeline.set_state(Gst.State.NULL)