title: How I can capture video from Android Canvas without root?
body: <p>I'm developing a painting app, with canvas and SurfaceView, and I want to record user operations, and generate video.</p>
  
  <p>In this moment I'm trying: </p>
  
  <pre><code>public static Bitmap captureView(View v) {
      Log.v(CAPTURE_TAG, "init");
      v.setDrawingCacheEnabled(true);
      v.buildDrawingCache(true);
      Bitmap b = Bitmap.createBitmap(v.getDrawingCache());
      //v.destroyDrawingCache();
      v.setDrawingCacheEnabled(false); // clear drawing cache
      Log.v(CAPTURE_TAG, "Fin:");
      return b;
  }
  </code></pre>
  
  <p>and I call this every 50ms, using timer, and AsynTask, on AsynkTask, on onPostExecute method I save the bitmap in external storage:</p>
  
  <pre><code>public class takeCaptureTask extends AsyncTask&lt;View, Void, Bitmap&gt; {
  
      @Override
      protected void onPostExecute(Bitmap result) {
          Log.v("taskCapt", "Fin - InitSave");
          new saveCaptureTask().execute(result);
      }
  
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
          Log.v("taskCapt", "init");
      }
  
      @Override
      protected Bitmap doInBackground(View... params) {
          return Utils.captureView(params[0]);
      }
  }
  </code></pre>
  
  <p>And finally generate video using NDK and ffmpeg.</p>
  
  <p>My problem is the performance, using this, every screenshot take 200ms (5FPS), and I need at least 15 FPS.</p>
  
  <p>My questions are:<br />
  1- I'm in the correct way to do the screen recording without root? <br />
  2- can I take screenshot of canvas using other methods?<br />
  3- It's posible take screenshots from NDK without root? in this case, how?<br />
  4- It's faster save data to External Storage using NDK?<br />
  5- How buffer a lot of images to process it later? </p>
  
  <p>My appologies for my bad English.</p>
  
  <p>Thanks a lot for your help!</p>