title: How to use Mediaprojection library in android to capture screen and convert into mp4 file?
body: <p>Since android 5.0 they are providing mediaprojection library to capture screen content. but sample demo application provided by them is not clear. U can find sample app <a href="https://github.com/googlesamples/android-ScreenCapture" rel="noreferrer">here</a>. In that application they are projecting captured screen using virtualdisplay method</p>
  
  <pre><code>private void setUpVirtualDisplay() {
      Log.i(TAG, "Setting up a VirtualDisplay: " +
              mSurfaceView.getWidth() + "x" + mSurfaceView.getHeight() +
              " (" + mScreenDensity + ")");
      mVirtualDisplay = mMediaProjection.createVirtualDisplay("ScreenCapture",
              mSurfaceView.getWidth(), mSurfaceView.getHeight(), mScreenDensity,
              DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
              mSurface, null, null);
      mButtonToggle.setText(R.string.stop);
  }
  </code></pre>
  
  <p>I want to convert captured screen into mp4 file for my screen recording application. Please help me to get through this.</p>