I am using python OpenCV to record videos of a process and want the ability to turn the camera on/off with a command line input. Currently I am turning the camera on with a command line input, but have to press a certain key to stop the video feed and save the video, which is not ideal.
I attempted using the pyautogui module to use a second program to trigger the keystroke that the first video recording script needed to end the recording, but it does not work.
If it is possible to have program A start recording and continue recording until it is triggered by program B, that would achieve what I want to do. Sleep methods do not work because the process length varies greatly.
Ideally the input to start would look like:
camera_recording_program.exe --save C:/path --camera 1
and the input to stop would look like:
camera_stop_program.exe --end True
I have tried various combinations of using python inputs and running things on the command line with subprocess without any luck. I am not able to get the two programs to communicate to each other. Also, the program is written in python and will use PyInstaller to convert to exe file.
Thank you!