I'm using a subprocess to run a command in terminal. I want to terminate the process when an event occurs by using the .terminate() function, however this doesn't seem to work.
pipeline = "gst-launch-1.0 \
nvcompositor name=comp \
sink_0::xpos=0 sink_0::ypos=0 sink_0::width=2560 sink_0::height=720 sink_0::zorder=1 sink_0::alpha=1\
sink_1::xpos=0 sink_1::ypos=0 sink_1::width=2560 sink_1::height=720 sink_1::zorder=2 sink_1::alpha=0.1\
! 'video/x-raw(memory:NVMM),format=RGBA' ! nv3dsink \
v4l2src device=/dev/video2 ! video/x-raw,format=YUY2,width=2560,height=720,framerate=30/1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA' ! comp.sink_0 \
videotestsrc ! videoconvert ! video/x-raw,format=RGBA ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA,width=2560,height=720' ! comp.sink_1"
camera = subprocess.Popen(pipeline, shell=True)
camera.terminate()
print("terminated")
It never prints out terminated
and the process continues running