Search code examples
androidbitmapandroid-viewandroid-imageandroid-bitmap

Android Take screen shot of view continuously so video can be created


I am using below code to take a screen shot of view continuously that have images in it. I am able to take 12-13 images(Bitmap) per second but creating video from 12-13 images not result in good quality. SO i want to know how can i take 24-25 images(Bitmap) per second. Can any one tell me about other android related library so 24-25 images(Bitmaps) can be taken in one second.

Below is code is running for 125 times so that i can get 24-25 images per second but i am getting 12-13 images. I am trying for 5 seconds so check is < 126:

    private void putCapturedBitmapToQueue()
    {           
       llCaptureArea.setDrawingCacheEnabled(true);
       llCaptureArea.buildDrawingCache();

       Bitmap objBitmap = Bitmap.createBitmap(llCaptureArea.getDrawingCache());

       llCaptureArea.setDrawingCacheEnabled(false);

       queBitmap.add(new SaveBitmap(Integer.toString(iCountIndex), objBitmap.copy(Config.RGB_565, false)));

       objBitmap.recycle();

       iCountIndex++;

       if(iCountIndex < 126)
       {
           objBitmap = null;
           putCapturedBitmapToQueue();
       }
    }

Solution

  • I would imagine that in optimal "lab" conditions, your code should work.

    But, in order to take so many screen captures per second - you are bound to hardware issues - camera speed, memory card speed, CPU speed, memory and so on..

    So, in more powerful devices you might get a higher FPS, but you can't really know ahead how it will work on different devices.

    If you are able to - you might want to look in to screen recording (Kitkat+)

    Look here

    Happy coding!