You can do either.Hello,
I'm building an interface for the raspberry pi hq cam with pyqt5 and picamera2.
I've made a menu with different settings including different resolutions (image ratio) and different framerates (24, 30, 60 and 120 fps) to record video in .h264 and .mp4.
Looking at the documentation, I confess I'm a little confused about the notion of framerate.
How do I configure it? UsingOr like this?Code:
picam2.set_controls({"FrameRate": 30})
Code:
config = picam2.create_video_configuration(main, lores=lores, display='lores',controls={"FrameRate": 30}, transform=Transform(hflip=1, vflip=1))
If you set it as part of the configuration (your 2nd example), then whenever you reapply that configuration you will restore that framerate, even if you had changed it in the meantime.
The first from can be used after "configure()" but before "start()", in which case that framerate will be applied immediately when the camera starts, but will not be "associated" with the configuration in the way that we saw previously.
That first form can also be used after "start()", in which case it will take "a few frames" to take effect.
"FrameRate" is just a convenience for users so that they can enter framerates instead of frame times. 24fps = 1000000/24 = 41667 microseconds, so use 41667 for 24fps (and so on).Or, as I've seen on some forums with FrameDurationsLimitsIn this case, if 40000 corresponds to 25fps. What are the framedurationlimits for 24, 60 and 120 fps?Code:
config = picam2.create_video_configuration(controls={"FrameDurationLimits": (33333, 33333)})
Yes, you should be able to change the framerate on the fly while recording a video.Is it possible to change the framerate when recording a .mp4 video with synchronized audio (usb microphone)? Or is it selected by default? And if it is chosen by default, what is its value?
The maximum framerate depends on the camera driver, which in turn depends on the camera sensor, the CSI2 connection and so forth. The quickest way to find out the maximum framerate for each mode is to typeAnother issue is framerate. I don't quite understand what maximum resolution is possible depending on the framerate chosen.
Code:
rpicam-hello --list-cameras
The hardware encoder only exists on Pi 4s and earlier. On a Pi 5 the H264Encoder is aliased to the LibavH264Encoder, which uses software. So you should be able to go larger than 1920 if you want. Usually performance should be better than 1080p30, but it will depend on what else the CPU is doing. It's a straight trade-off between framerate and resolution here. More resolution, fewer frames and vice versa. You'll have to experiment for your own use cases.I have a rapsberry pi 5 8go, I record videos on an ssd. So harware isn't too much of a problem.
I'd like to record videos in 2028xheight (depending on the ratio chosen) with the best possible quality without loss of fps. But I read in the documentation that : The H264Encoder class implements an H.264 encoder using the Pi's in-built hardware, accessed through the V4L2 kernel
drivers, supporting up to 1080p30. The constructor accepts the following optional parameters:
Do I need to reduce the resolution to 1920 pixels?
At what framerate should I reduce the resolution?
I think 2028x1524 is limited to 40fps (check "rpicam-hello --list-cameras"), so you absolutely can't get 50fps there. In practice, I don't think the software encoder would give you 40fps either, that's just too many pixels. rpicam-vid is a bit more efficient than Python because it avoids some Python-related overheads, but not massively so.In section 4.2.2.3. Raw streams and the Sensor Configuration
I read that for 120fps I can have a max resolution of (1332, 990)
For 50fps (2028, 1080).
So if I record in a 1.33 ratio, i.e. 2028x1524, I can't record in 50fps?
Statistics: Posted by therealdavidp — Tue Apr 02, 2024 1:15 pm