Skip to content
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

Very poor performance #37

Open
jeroenhouben opened this issue Mar 9, 2019 · 7 comments
Open

Very poor performance #37

jeroenhouben opened this issue Mar 9, 2019 · 7 comments

Comments

@jeroenhouben
Copy link

This library works great when using very low quality settings but as soon as as I set jpeg quality over like 30 or 40 I get timeouts. This is for still images. Also full hd 1920x1080 stills don't work with quality of 20. Is this why the default quality is set to 15?

I'm using a pi zero, so maybe it is just not powerful enough? I'm using nerves. I'll try installing raspbian and use the command line tools (https://www.raspberrypi.org/documentation/raspbian/applications/camera.md), see if they yield the same disappointed results.

@fhunleth
Copy link
Collaborator

fhunleth commented Mar 9, 2019

Fwiw, the Raspberry Pi camera commandline tools are installed in the default Nerves images.

@jeroenhouben
Copy link
Author

Hmm wel just using something like this works fine:

System.cmd("raspistill", ["-n", "-q", "75", "-o", "/root/2.jpg"], stderr_to_stdout: true)

this outputs a big jpg 4.5MB 3280 × 2464

@GregMefford
Copy link
Collaborator

I believe the reason is that we allocate a static memory buffer for the video frames and it’s not very big. This is something I’d like to work on improving, because there’s no inherent reason to impose a hard limit, other than saving memory for other processes to use.

@electricshaman
Copy link
Contributor

@GregMefford Could we use a Stream somehow?

@noozo
Copy link

noozo commented Mar 20, 2020

Any update on this?

@herrnesto
Copy link

Hmm wel just using something like this works fine:

System.cmd("raspistill", ["-n", "-q", "75", "-o", "/root/2.jpg"], stderr_to_stdout: true)

this outputs a big jpg 4.5MB 3280 × 2464

The Problem with this is, that you loose time while starting up the camera process. You have to run it in background all the time, otherwise it takes ~0.5 - 1 Second after you "pull" the trigger. More infos here: https://raspberrypi.stackexchange.com/questions/23698/raspistill-slow-to-trigger
(not sure if this works with nerves)

@GregMefford
Copy link
Collaborator

If I understand the original problem correctly, the issue isn't that it takes a long time, but that it fails altogether for larger resolutions at higher quality settings. I believe this is because the data buffer we allocate for storing the compressed JPEG data isn't very big but it is hard-coded in C, so we'd need to rework some things to make it support arbitrary-size frames. This is still something I'd like to fix, but I'm not that good at C and there are a lot of moving parts in there to make sure I don't break something else accidentally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants