I am using raspberry pi to capture videos 24/7. I have been using picamera's recording function :
import picamera
camera = picamera.PiCamera()
camera.start_recording('output_file.h264')
camera.wait_recording(600)
camera.stop_recording()
This creates .h264 file.
Now, I am trying to do some things with captured frames (object detection etc.) and therefore need to use other methods to write videos, like opencv's VideoWriter.
Here's my main question: When using picamera, it does not care if the process was killed while recording. I.e. if the process was killed after 300 seconds(for any reasons), the output file still has 300 seconds of video, uncorrupted. However, when I used cv2.VideoWriter to save .mp4 file, when it was not properly released, the video file showed corrupted. What method can I use to write Videos that behaves like picamera?
Any other approaches are welcome too.