Running bookworm and picamera2
If I run circular_capture_nooutput.py from the examples on GitHub it works. I would like to change it to save a .mp4 file rather than a .h264. I have changed the encoder and file type here -It appears to run OK but when I try to play the file using Celluloid it give me a blank screen for a little while then the message "Playback was terminated abnormally. Reason:unrecognized file format."
How can I get it to record an .mp4 (or other web friendly format) file
I have found loads of info on line but nothing that explains how to do this. Can anyone help please?
Thanks
Mick
If I run circular_capture_nooutput.py from the examples on GitHub it works. I would like to change it to save a .mp4 file rather than a .h264. I have changed the encoder and file type here -
Code:
#!/home/pi/.venv/bin/python#based on circular_capture_nooutput.pyimport timefrom picamera2 import Picamera2from picamera2.encoders import MJPEGEncoderfrom picamera2.outputs import CircularOutputpicam2 = Picamera2()fps = 30dur = 10micro = int((1 / fps) * 1000000)vconfig = picam2.create_video_configuration()vconfig['controls']['FrameDurationLimits'] = (micro, micro)picam2.configure(vconfig)encoder = MJPEGEncoder()output = CircularOutput(buffersize=int(fps * (dur + 0.2)), outputtofile=False)output.fileoutput = "file.mp4"picam2.start_recording(encoder, output)time.sleep(dur)output.stop()
How can I get it to record an .mp4 (or other web friendly format) file
I have found loads of info on line but nothing that explains how to do this. Can anyone help please?
Thanks
Mick
Statistics: Posted by micksulley — Mon Apr 15, 2024 11:06 am