Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3923

Camera board • Getting the most FPS/Quality out of the Pi Camera Module

$
0
0
Hi All,
For a web camera motion detection project, I Have the PI5/8GB, Picamera2 Bookwork, SSD write speed 200Mb/s and I noticed the libcamera claims for FPS on my camera:

0 : imx708_wide [4608x2592 10-bit RGGB] (/base/axi/pcie@120000/rp1/i2c@80000/imx708@1a)
Modes: 'SRGGB10_CSI2P' : 1536x864 [120.13 fps - (768, 432)/3072x1728 crop]
2304x1296 [56.03 fps - (0, 0)/4608x2592 crop]
4608x2592 [14.35 fps - (0, 0)/4608x2592 crop]


Of course, this must mean what the camera is capable of maybe in a preview mode, but not necessarily when saving to JPG/MP4 that as soon as you start compressing video and jpg's on the PI5 the frame rate will go down. At least the way I got things rigged.
cam_fps_mpg4.png


So basically, I record to MP4 (with audio) for 10 seconds, while I am waiting for the 10 seconds to elapse, I'm snagging as many images I can and running a fast motion detection on them and then saving the frames off to disk. Motion detection processing is negligible, it runs fast.

while not shutdown_engaged:
output = FfmpegOutput(mp4_file, audio=True)
picam2.start_recording(encoder, output, quality=Quality.VERY_HIGH)


while tn < future :
curr_frame = picam2.capture_array()

# Do motion detection here
if (motion_detected):
save_image(curr_frame,mImg)

picam2.stop_recording()


So i guess the first question is -- does this look like a sane way of doing things? Is there a faster way to get more FPS out of this, because right now it just seems like I can capture around 1.5 FPS, and of course the video is what it is at around 12.5fps above. SO combined, 14fps ... not real great.

I was hoping to save a lot of bandwidth to have the PI do some rudimentary motion detection ROI's and then send these over across the network to an image classifier to see if it's anything recognizable in the action areas. If there is no motion, don't save/send anything.

Another way would be to nix MP4, capture as many frames along with use arecord to capture audio and then send them over to a server to encode them into MP4 Frames would be Hi-Res, but audio might drift.

Is this the best it gets with the PI5?

Would it be better, or is it possible if I wanted to get the full 12 MP resolution to just stream frame and audio to a faster server that has NVidia CUDA/FFPMEG that will take the raw data and encode it on the fly with the GPU acceleration?

Statistics: Posted by UltimateCodeWarrior — Mon Dec 16, 2024 11:05 pm



Viewing all articles
Browse latest Browse all 3923

Trending Articles