I need to record and save a video and its corresponding audio using Python. I am able to individually do that (save audio and then save video), but it does not happen simultaneously.
Of course, I thought of using multiprocessing, but that still did not work
p1 = Process(target=listen_to_speaker())
p1.start()
# needs to run at the same time as
p2 = Process(target=record_save())
p2.start()
Here,
listen_to_speaker()
records the audio and saves it in a .wav
file (and also stores the text conversion of that audio by using the speech_recognition
module).
record_save()
uses OpenCV to record a video from the Webcam and stores it in an .avi
file
Currently, the audio is recorded and saved, and then the webcam is turned on for recording the video.
I also tried adding:
p1.join()
p2.join()
There was no change in the way things turned out.
My expected result is 2 files, one video and one audio, which correspond to each other.