Preface
When we usually write blogs, we often need to take screenshots, record videos, or make gif movies.Today, we rely on it to discuss what methods are available.
First method:
The screen of your mobile phone is projected to your computer, and you can take screenshots, record videos, or make gif movies using the software on your computer.
Phone screen synchronization all PC, we can use Vysor This chrome plugin, screenshots We can use QQ screenshot shortcut keys Ctrl + Alt + A to make gif motion maps We can use gif conversion tools LICEcap
Download Address
Tools for synchronizing mobile screen to computer Vysor , this is a chrome plugin and needs to be turned over
The useful gif conversion tool LICEcap, Official address,Download Address
Second method:
Use the adb command.Let's take a look at how to use the adb command for screenshots.
adb screen capture command screencap
First method
//(Save to SDCard)
adb shell /system/bin/screencap -p /sdcard/screenshot.png
// Export from SD card to computer, note that F:\mvp is the computer path and must exist
adb pull /sdcard/screenshot.png F:\\mvp(Save to Computer)
If you want to delete pictures from your phone, you can use this command to delete them
adb shell rm /sdcard/screen.png
Second method
adb shell screencap -p | sed 's/\r$//' > screen.png
It is important to note that the picture will be saved in the current cmd boot path, screen.png is the name of the picture
For example, if I execute a command in C:\Users\Administrator, it will be saved in the C:\Users\Administrator directory.
C:\Users\Administrator>adb shell screencap -p | sed 's/\r$//' > screen.png
extend
If you think you have to type this long command adb shell screencap -p | sed's/\r$/'> screen.png every time, for fear of not remembering, there are some ways we can do that.That's wrapped in alias, which means alias.
Since alias is a linux-specific command, we can no longer use it on windows. If you want to use similar functionality on windows, you can refer to the following blog.
Configuring alias commands on Linux using doskey in Windows
Create alias for the Windows command line
adb recording command screenrecord
brief introduction
- screenrecord is a shell command
- Supports Android 4.4(API level 19) above
- Supports video format: mp4
Some restrictions
Some devices may not be able to record directly because the resolution is too high. If you encounter this problem, try specifying a lower resolution
Screen rotation during recording is not supported. If rotation occurs during recording, the picture may be cut off
Sound will not be recorded while video is being recorded
Start recording command:
adb shell screenrecord /sdcard/demo.mp4
Description: Record the screen of your mobile phone in mp4 video format and store it in the sd card of your mobile phone. The default recording time is 180s
Limit recording time:
Parameter: - time-limit
adb shell screenrecord --time-limit 10 /sdcard/demo.mp4
Description: Limit video recording time to 10s, if not, default 180s
Specify video resolution size:
Parameter: - size
adb shell screenrecord --size 1280*720 /sdcard/demo.mp4
Description: Record video at 1280*720 resolution. For best results, use the size supported by Advanced Video Coding (AVC) on your device if you do not specify the default resolution for using your mobile phone
Specify the bitrate of the video
Parameter: - bit-rate
adb shell screenrecord --bit-rate 6000000 /sdcard/demo.mp4
Description: Specify a video bit rate of 6Mbps, otherwise default to 4Mbps. You can increase the bit rate to improve video quality or reduce the bit rate to make the file smaller
Display log on command line
Parameter: - verbose
adb shell screenrecord --time-limit 10 --verbose /sdcard/demo.mp4
Enter the command above to see this information.
Main display is 1080x1920 @59.16fps (orientation=0)
The max width/height supported by codec is 1920x1088
Configuring recorder for 1088x1920 video/avc at 4.00Mbps
Content area is 1080x1920 at offset x=4 y=0
Time limit reached
Encoder stopping; recorded 133 frames in 10 seconds
Stopping encoder and muxer
Executing: /system/bin/am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file:///sdcard/demo.mp4
Broadcasting: Intent { act=android.intent.action.MEDIA_SCANNER_SCAN_FILE dat=file:///sdcard/demo.mp4 }
Broadcast completed: result=0
Rotate 90 degrees
Parameter: - rotate
Description: This function is experimental, good or bad, do not know
View Help Commands
Parameter: - help
Enter the following command
adb shell screenrecord --help
You will see this information.
Usage: screenrecord [options] <filename>
Android screenrecord v1.2. Records the device's display to a .mp4 file.
Options:
--size WIDTHxHEIGHT
Set the video size, e.g. "1280x720". Default is the device's main
display resolution (if supported), 1280x720 if not. For best results,
use a size supported by the AVC encoder.
--bit-rate RATE
Set the video bit rate, in bits per second. Value may be specified as
bits or megabits, e.g. '4000000' is equivalent to '4M'. Default 4Mbps.
--bugreport
Add additional information, such as a timestamp overlay, that is helpful
in videos captured to illustrate bugs.
--time-limit TIME
Set the maximum recording time, in seconds. Default / maximum is 180.
--verbose
Display interesting information on stdout.
--help
Show this message.
Recording continues until Ctrl-C is hit or the time limit is reached.
Export video:
adb pull /sdcard/demo.mp4
Description: Export video to current directory
Go everywhere to the specified directory
adb pull /sdcard/demo.mp4 F:\mvp\demo.mp4
Making gif motion pictures
utilize LICEcap Convert.
Off-topic topic
The first method is almost as efficient as the second (using the adb command) in capturing and recording videos, but much faster when making gif maps. Why explain the adb command?
One: Let everyone know that there are more ways to broaden their horizons (Ha-ha, I am actually teasing eggs);
2: When using Vysor projection, some mobile phones do not support it. As a second generation, we are sometimes very helpless. It is impossible to say that in order to be able to use Vysor for projection and buy a new mobile phone, at this time, we will step back and use adb command.
Three: As a developer, we still need to learn some common commands.In this way, you can also pretend to be pressing.