-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HOW-TO] Dropping frames when recording w/ picamera2, but not with libcamera-vid (1080p60) #1026
Comments
Hi, yes there are some challenges here, not least because there's quite a lot of Python code running now whereas libcamera-vid is a native C++ application. Running more Python code may cause additional problems, though course it depends what you're doing (we know that Python can't always make use of multi-threading very well, though if most of your Python tasks are sleeping or waiting for I/O then it mostly works). Officially, only 1080p30 is supported. In practice, folks mostly manage to get up to about 1080p50 but I think anything beyond that is quite speculative. Some other things to try:
|
Thanks David, sorry for the late reply. Finals just wrapped up. I am running the lite version and my only interface with it is through SSH. I have double checked to make sure Setting I'm not exactly sure what I should be looking for when writing to I may end up sacrificing some resolution/framerate and just be happy with the way it'll be. I'll have to play around with it a bit and see how I feel. Thanks again. |
As I think I said, mostly folks find that they can't quite reach 1080p60 using Python, but they get close. The videos may be better if you reduce the framerate to (for example) 50fps, as the output can look rather choppy if it's randomly dropping frames. To try
which will write to a memory filesystem. Again this should be faster than a real filesystem, but will only be possible if your files are not too large (compared to the amount of RAM your Pi has, though that could indeed be a problem on a Pi Zero 2). Also, those files get lost on a reboot, so you have to copy them to the "real" filesystem if you need to keep them. |
I'm running a Pi Zero 2 W, overclocked. I can consistently get a nice, smooth 1080p60 video out of it using:
libcamera-vid --frames 300 -b 5000000 --width 1920 --height 1080 --framerate 60 -o test.h264 --level 4.2 --denoise cdn_off
The end goal is essentially a dashcam for a rocket, where the Pi is recording and deleting videos at timed intervals until it detects a launch, where it will continue recording until it lands, then save said recording. It needs to be small & light (and not cost a small fortune), which is why I've chosen a Pi Zero.
The video I'm getting out of my program is sped up (like the Pi isn't fast enough), though it is 60fps, which I assume means I'm dropping frames.
Here is my configuration within the program:
The only setting I can't (or don't know how to) set in the program is the H264 target level.
On the docs, it does mention that the H264 tops out at 1080p30, but this thread seems to suggest that is not the case.
Are there any other settings I can try? Why is the performance different between the CLI and Python?
I still need to be sampling an accelerometer while recording to check for launch/landing. Will this just make the problem worse?
Thanks in advance.
The text was updated successfully, but these errors were encountered: