title: Android Screen-recording of complete screen
body: <p>I'm having a problem with the screen recording in Android. I'm looking for a way to record the screen. The approach I'm looking for must fulfill the following requirements:</p>
  
  <p>a) It can have ROOT. I read a lot of the threads here and I think it should be
  easier with root. So this is no limiting factor for me. </p>
  
  <p>b) It should work on Tegra2 or Tegra3 devices such as the Nexus 7. Thus, frame buffering approaches will not give the expected result to me. </p>
  
  <p>c) It should be able to record the full screen in background using a service. So, it should not be limited to my own application.</p>
  
  <p>d) It should be run on the device only. So, no connecting to PC should be necessary. </p>
  
  <p>What I tried so far:</p>
  
  <p>1) I tried to use the amazing new screen record feature of Android 4.4. So I gained root rights and executed the command from within my application. This works fine, but the approach has two problems:</p>
  
  <p>i) I did not find a way to stop the current recording.</p>
  
  <p>ii) The recording is limited to 3 minutes. I need at least 10 minutes. </p>
  
  <p>2) I implemented an approach which takes screenshots while the service is running and stores them in a folder on the sdcard. This is done by using the <code>/system/bin/screencap -p</code> command. However, this approach is really slow. It only achieves to make a screenshot every second, such I only would get an FPS rate of 1. However, my goal is not to achieve an FPS rate of 30. 6-8 FPS would be sufficient. Moreover, I did not find a way to encode the .png files as a video. </p>
  
  <p>On the APP store I found an application (SCR Screen Recorder) which is able to do exactly the thing I'm looking for. So, I think it is possible. However, my app should be able to do it without requiring additional apps. Thus, an Intent is no option for me.</p>
  
  <p>Best regards,
  mister-viper</p>
  
  <p><strong>UPDATE 1</strong>
  So I'm now able to start and stop the screenrecording for Android 4.4 programatically.
  Here it is important to not KILL the screenrecord process using the standard kill command.
  You have to use the <code>kill -SIGINT &lt;pid&gt;</code> command - otherwise you get and coruppted video file. The PID of the screen record process can be get by calling <code>ps screenrecord</code> and then doing some processing on the resulting string. Now I only need an approach for merging all the video files programmatically. </p>
  
  <p><strong>UPDATE 2</strong>
  Finally, I also managed the last part. First, I use a Timer and a TimerTask which allow me to start a new screenrecording every 3 minutes until the user hits stop. Using the solution described in Update1, I them stop the recording. After doing the complete recording I start a post-processing step. In this step I use the mp4parser library to merge the video files into a single one. The answer for that was also available here on stackoverflow <a href="https://stackoverflow.com/questions/13514317/how-to-concat-or-merge-two-or-more-video-files-in-android">click</a>.</p>
  
  <p>Thank you all for your answers. Under the requirements of root access and Android 4.4 I now have a running screen-recording. For my purposes this is fine. However, I think there are enough developers which have other requirements. So feel free to answer here, if you have further ideas.   </p>