1

I have two subprocesses as I showed below

cmd1='arecord -d 0 -f cd -t wav test.wav'
cmd2='raspivid -o video.h264 -fps 25 -t 0'

pro1 = subprocess.Popen(cmd1, shell=True)
pro2 = subprocess.Popen(cmd2, shell=True)

I want to record audio and video at the same time with raspberry pi. From now on I can start both programs but I cannot stop these programs. Can anybody help me?

Or any idea for doing by simple way this process?

0

2 Answers 2

2

From the docs:

Popen.terminate() Stop the child. On Posix OSs the method sends SIGTERM to the child. On Windows the Win32 API function TerminateProcess() is called to stop the child.

New in version 2.6.

Popen.kill() Kills the child. On Posix OSs the function sends SIGKILL to the child. On Windows kill() is an alias for terminate().

Sign up to request clarification or add additional context in comments.

Comments

0

The documentation for Python's subprocess module includes a description of Popen.terminate() and Popen.kill().

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.