Capture android screen and create video programmatically - java

In Android/Java, Is there any code example to capture the screenshot of a computer with good frames per second programatically and create video?
I'd like a tutorial or full source code to do this. I'd like the program to work with and without the device having been "rooted".
There is app in the play store called Screencast Video Recorder that does this. But you need to ROOT the device for it to work, so I know it can be done.
What's the best way to capture android screenshot and create a video programmatically on a non-rooted device?

There is an app called Telecine that is open source that allows you to record screens - the code can be found at https://github.com/JakeWharton/Telecine. All credit is to Jake Wharton.
If you need an example, you can find one at Commonsware's github page - Mark Murphy has provided a sample app for both screen capture and screen recording using the MediaProjection APIs.

you can capture the screen via using DDMS as adb runs and has permission to the framebuffer:
follow this link for more details :
http://thetechjournal.com/electronics/android/how-to-capture-screenshots-and-record-video-on-android-device.xhtml
ALSO
check this links may be get some ideas about what you need :
http://answers.oreilly.com/topic/951-how-to-capture-video-of-the-screen-on-android/
http://www.mightypocket.com/2010/09/installing-android-screenshots-screen-capture-screen-cast-for-windows/
and check this project :
http://sourceforge.net/projects/ashot/
hope this help .

Check the following link
https://code.google.com/p/java-remote-control/
in this project the owner has created a java remote control i.e. he has captured the images from the remote computer and transfer to server and convert it to movies with different format all you need to understand what he has done and implement the same for all your needs. you can access the full source code with SVN client from the following URL
http://java-remote-control.googlecode.com/svn/trunk/
Also you can look for the Remote class in java which provides createScreenCapture method

As of Android 4.4, there is a screen recording feature accessible via adb.
http://developer.android.com/tools/help/adb.html#screenrecord
The screenrecord command is a shell utility for recording the display of devices running Android 4.4 (API level 19) and higher. The utility records screen activity to an MPEG-4 file, which you can then download and use as part of a video presentation. This utility is useful for developers who want to create promotional or training videos without using a separate recording device.

Try this application from the market
https://play.google.com/store/apps/details?id=com.ms.screencastfree
** Does not work on Galaxy Nexus or Tegra 2/3 yet **
EDIT 28/11/2014
Lollipop has been released and provides a new Screen recording API
http://developer.android.com/about/versions/android-5.0.html#UI
Screen capturing and sharing
Android 5.0 lets you add screen capturing and screen sharing
capabilities to your app with the new android.media.projection APIs.
This functionality is useful, for example, if you want to enable
screen sharing in a video conferencing app.
The new createVirtualDisplay() method allows your app to capture the
contents of the main screen (the default display) into a Surface
object, which your app can then send across the network. The API only
allows capturing non-secure screen content, and not system audio. To
begin screen capturing, your app must first request the user’s
permission by launching a screen capture dialog using an Intent
obtained through the createScreenCaptureIntent() method.
For an example of how to use the new APIs, see the MediaProjectionDemo
class in the sample project.

Related

Can you write an app that records the screen of a specific app in Android Java?

I'm try to make an android app that records specify app's screen and audio.
How can I record the screen?
Here's an example for using MediaProjection API for screen recording on Android: GoogleSource You can add Service class to run in a background check when a certain app package is opened. Here's an example to check an app running on Android. Stackoverflow Example

How to programmatically check build.prop to verify model

I have an app I'm currently working on based on the HTC Open Sense SDK for android. However my biggest problem is keeping up with the device checker through the Google Play dev console to only allow certain devices to download the app. My biggest reason is that people will rate my app so low on the scale and say it sucks, but the problem is that they don't read the requirements - if you use an Lg G2 to try and launch an app made for an HTC ONE that requires Sense, it's going to crash.
So, how would i go about building a helper class that would check the device's model via build.prop (without needing root privileges) before opening/starting the main activity, and give the user a notification if the device was incapable of launching the app, and with devices that are capable of launching it, just continue the process of opening the app?

Using the Camera in my app.

I've tried to start the camera and use it my app - with unsatisfactory results. I followed the sample code provided in the android SDK (the Preview class), and I got bad results - the camera was rotating and when I tried to add a button, it never showed up.
I checked other apps and it looks like the skype app uses the same camera app as the one built into the phone. I want to know how I can implement this in my own app. Any solutions?

Invoke in-built gingerbread screenshot facility via code

From Gingerbread onwards there is a built-in OS facility for taking screenshots (on non-rooted phones as well).
By pressing home and power button together and it also saves it to a folder on the SD card.
Is there a way to invoke this via code? The ability to take a screenshot is needed as part of my other app. There is an app named screenshot-UX that has a method called embedded screenshot capture, which I believe invokes that.
Does anyone know how to invoke the built-in Gingerbread screenshot facility or even how to use it? (with having optional parameters like save path, extensions etc..) as well as for non-rooted phones.
This is not a built-in feature of the Android platform at the Gingerbread (2.3) level, although some OEMs did include it (Samsung, for instance, has you press HOME and BACK at the same time). It was not introduced to the platform as something users could do with a button sequence until 4.0, where the sequence is now to press the Power and Volume buttons at the same time.
Even still, there is no public API via which developers can take screenshots. The way that screenshot apps capture images Android devices is to read the frame buffer directly via the SurfaceFlinger in native code.

Controlling Mobile Devices Camera On A Mobile Site

We are developing a mobile web application which user's can reach via their mobile phones' browser. (It's not a mobile phone application, it's a web site for mobile phones) .
We want to get (upload) pictures directly from user's telephone's camera. How we can control user's camera ? I know it's not possible for mobile web site. But for example can we use Java for this? Or can we develop small plugins for mobile phones and trigger it, when user click on Capture a Photo link ?
Can you give any advices us please? Thanks !
(except this answer on this question :
can users take pictures and videos before and then select the file via
a browser dialog (if that is supported by mobile browsers) and select
those files to be uploaded)
Q&A's from comments :
1) Well what phone operating systems are you targeting? iOS, for example, has no ability to run Java.
Actually, we are targetting all OS.
iOS has no ability to access the camera from a website. You cannot load Java on iOS at all, either.
Android had the ability to access the camera from HTML demoed a while back, but I can't find anyplace noting that it actually made it into a release.
Blackberry as far as I know also has no such ability to access the camera from a website.
If you wish to use Java, you can develop an actual app for Android or Blackberry. iOS apps are written in Objective C.
However, using PhoneGap you can write an app in HTML5 & Javascript and it will create a native iOS (for 3GS or later) or Android app capable of accessing the camera.

Categories