Reprint please indicate the source: a column of Maple Leaf
Recently, my classmates asked me how my Android phone's recording screen and how to convert it into a GIF are implemented? Today is the time to talk about Android recording screen and conversion GIF operation. The entire Android system recording and conversion GIF is divided into two parts, recording process and conversion process, the following detailed introduction of these two parts of the specific process.
Recording screen operation of Android phone
The Android phone also has some software to record the screen, but as a programmer it is recommended to use the ADB command to record the operation of the screen, and below we will introduce the ADB command to implement the screen recording function: Screenrecord.
- About the Screenrecord command
It should be explained here that Screenrecord is the ADB command after Android 19, so if your phone is android4.4 below, there is no way to use this command to perform the recording screen operation ...
- Screenrecord command Explanation
Below we perform the ADB Shell screenrecord–help command in the terminal of Android studio to see an introduction to the Screenrecord command:
? Platform-tools./ADB Shell Screenrecord--helpUsage:screenrecord [options] <filename>android Screenrecord v1. 2. Records theDevice ' s display toA. mp4file. Options:--size widthxheightSet theVideo size, e.g."1280x720". Default is theDevice ' s main display resolution (ifSupported), thex720if not. For best results, use a size supported by theAVC Encoder.--bit-rate RateSet theVideo bit rate,inchBits perSecond. Value may specified asBitsormegabits, e.g. '4000000‘ isEquivalent to‘4M '. Default4Mbps.--bugreportAdd additional information, such asA timestamp overlay, that isHelpfulinchVideos captured toIllustrate Bugs.--time-limit TimeSet theMaximum recording Time,inchSeconds. Default/maximum is .--verboseDisplay Interesting information onStdOut.--helpShow this message. Recording continuesuntilCtrl-c isHitor the TimeLimit isReached.
The first line is mainly about the Screenrecord command the current version is 1.2, which is used primarily to record the behavior of the device into a. mp4 file.
The simplest way to use this is:
screenrecord options xxx.mp4
Options its optional parameters, mainly include: Size,bit-rate,bugreport,time-limit,verbose,help, etc., the meaning of the specific options are listed above.
- Screenrecord Command Practice
All right, let's get to practice. Record screen video with the Screenrecord command. Open the terminal of our Android studio, connect the phone, and then perform:
shell screenrecord /sdcard/test1.mp4
It is important to note that the command supports a maximum size of 1920 * 1088 for a recording screen, and a larger screen recording can use the options size to perform the screen size.
Then we will record the video name of the Test1.mp4,screenrecord command is the default support for the export format is MP4, so the name here is Test1.mp4, but if you have to be named Test1, or Test1.sss, or test1.txt, etc., it seems Nothing serious.
Then we have a video file called Test1.mp4 in the root directory of the SD card of the phone.
Video Conversion GIF operation
With the Creenrecord recording command above, we got the screen operation video file: Test1.mp4, and our next step is to convert the MP4 file into a GIF file. Because of the use of Mac computers, tried several video conversion gif software feeling is not very good, and finally found a better video to GIF site: ezgif, you can look at its main features:
It is mainly the operation function of GIF graph. Let's take a look at how the site converts MP4 files into GIF images.
- Select Video file, perform upload operation
- Perform a specific convert to GIF operation
You can set the length, size, and so on of the GIF graph during execution.
Okay, so that's all we have to do with the Android screen recording and conversion gif. It's not very complicated.
Android Tips (ix)-->android recording screen and conversion GIF image