The H264 files created by my script are often missing huge chunks of footage.
My script is based on the capture_circular_stream.py example (a combination of mjpeg_server.py and capture_circular.py), but with a hardcoded capturing delay instead of being based on motion detection.
The encoder is set up like so:
The data is encoded manually:
The code to save the circular buffer is this:
How can I get consistent results?
Also, this is probably an unrelated issue, but when I later create an MP4 from the H264 the framerate/playback speed is always slightly faster than real time (roughly +20%).
My script is based on the capture_circular_stream.py example (a combination of mjpeg_server.py and capture_circular.py), but with a hardcoded capturing delay instead of being based on motion detection.
The encoder is set up like so:
Code:
file_encoder = H264Encoder()file_encoder.framerate = 30file_encoder.size = config["lores"]["size"]file_encoder.format = config["lores"]["format"]file_encoder.bitrate = 5000000circ = CircularOutput(buffersize=30*60)file_encoder.output = circfile_encoder.start()
Code:
try: while True: request = picam2.capture_request() file_encoder.encode(lores_stream, request) request.release()finally: file_encoder.stop()
I would expect the resulting video to be two minutes long. Instead it is shorter, sometimes much shorter. For example, it might have the first 36 seconds from the circular buffer, but is missing the rest, including the moment when circ.start() is called. Other times it is missing only 20 seconds or so.circ.start()
time.sleep(60)
circ.stop()
How can I get consistent results?
Also, this is probably an unrelated issue, but when I later create an MP4 from the H264 the framerate/playback speed is always slightly faster than real time (roughly +20%).
Statistics: Posted by tem — Tue Feb 27, 2024 4:11 pm