Search code examples
androidcamerafrequencyphotos

How big is interval between taking pictures in Android phone?


I'm wondering how fast I can take pictures one after another withoud surprises from the phone (like fx: 'force close;)

Does any of you know that time?

I know that 500 milisec is safe time. When i experiment with 100, 200, 300 milisec there is error but who knows, maybe i do sth wrong.


Solution

  • This absolutely depends on what you define as "take a picture" - as Nathan mentioned, when recording video (basically a series of scaled-down, compressed pictures) you can "take" a picture every 30ms. But if you define "taking a picture" as copying a 5MP jpeg picture to the SD card, this will probably take longer.

    You have to explicitly describe what you mean when you say "just make a loop(to take 1000 pics)," especially when you are complaining of errors.

    Assuming you extend the Camera.PictureCallback interface, a lot of processing goes on behind the scenes before you get passed the picture (like jpeg compression, I believe). Have you tried throwing an event inside your implementation of onPictureTaken to take another picture? This might be a safe way of doing and testing what you want. Otherwise if you fire off a ton of "take a picture" events, some kind of heap overflow might happen, I don't know.

    Edit: Roughly speaking, this is what I meant:

    public void onPictureTaken(
            final byte [] data, final android.hardware.Camera camera) {
        saveDataToFile("/DCIM/tempjpeg.jpg", data);
        camera.takePicture(null, null, this);
    }
    

    Call takePicture as soon as you can - right in the callback! DO NOT USE THIS without modification, since this will loop forever. I tried this, and it works for a couple pics, then is just stops responding. If you stop it after two pics, it seems to take under a second on a Nexus One. Hopes that helps.