title: Screen recording of specific views in Android
body: <p>I need to record certain views in an android application, both <code>audio</code> and <code>video</code>. Say, I have a layout inside <code>.xml</code> file and I want to create a <code>video(.mp4)</code> of only that view. Whats the best approach or possible solution? So far, my finding is:</p>
  
  <ol>
  <li><a href="https://developer.android.com/reference/android/media/projection/MediaProjection.html" rel="nofollow noreferrer">MediaProjection</a> only records the whole screen which is NOT my requirement.</li>
  <li><a href="https://github.com/bytedeco/javacv" rel="nofollow noreferrer">Javacv</a> - Since the size of JAR file is way too large and I am already at the edge of meeting the <code>apk</code> size limit(100mb), plus I am already using <a href="http://ffmpeg.org/" rel="nofollow noreferrer">FFMPEG</a> and <a href="http://opencv.org/" rel="nofollow noreferrer">OpenCV</a> and facing <code>UnsatisfiedLinkingError</code> with Javacv. (I don't want to go for this unless there is no other option left.)</li>
  </ol>
  
  <p>One possible solution that comes to my mind is to grab frames(bitmaps) of that view and combine them with audio to create a video file. </p>
  
  <p><strong>Question:</strong>
  Is this possible with <a href="https://developer.android.com/reference/android/media/MediaRecorder.html" rel="nofollow noreferrer">MediaRecorder</a> to use the frames and audio to create a video file? How can I pass the frames to <code>MediaRecorder</code>. All I could find about <code>MediaRecorder</code> is how to stream Camera frames on <a href="https://developer.android.com/reference/android/view/TextureView.html" rel="nofollow noreferrer">TextureView</a>.</p>