Back to rankings

yrom/ScreenRecorder

Java

Implement screen capture without root on Android 5.0+ by using MediaProjectionManager, VirtualDisplay, AudioRecord, MediaCodec and MediaMuxer APIs

android-applicationscreen-capture
Star Growth
Stars
1.9k
Forks
543
Weekly Growth
Issues
50
5001k1.5k
Nov 2014Sep 2018Aug 2022Jul 2026
ArtifactsMavengit clone https://github.com/yrom/ScreenRecorder.git
README

Screen Recorder

这是个DEMO APP 主要是实现了屏幕录制功能(可同时录制来自麦克风的声音)。

screenshot

Get it on Google Play 点此处下载APK 快速预览项目功能

说明:使用了 MediaProjectionManager, VirtualDisplay, AudioRecord, MediaCodec 以及 MediaMuxer 等API,故而这个项目最低支持Android 5.0。

录屏原理

** 注意 ** 你可以checkout 32c005412 查看原始的(不包含麦克风录制的)代码

  • Display 可以“投影”到一个 VirtualDisplay
  • 通过 MediaProjectionManager 取得的 MediaProjection创建VirtualDisplay
  • VirtualDisplay 会将图像渲染到 Surface中,而这个Surface是由MediaCodec所创建的
mEncoder = MediaCodec.createEncoderByType(MIME_TYPE);
...
mSurface = mEncoder.createInputSurface();
...
mVirtualDisplay = mMediaProjection.createVirtualDisplay(name, mWidth, mHeight, mDpi, DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC, mSurface, null, null);
  • MediaMuxer 将从 MediaCodec 得到的图像元数据封装并输出到MP4文件中
int index = mEncoder.dequeueOutputBuffer(mBufferInfo, TIMEOUT_US);
...
ByteBuffer encodedData = mEncoder.getOutputBuffer(index);
...
mMuxer.writeSampleData(mVideoTrackIndex, encodedData, mBufferInfo);

所以其实在Android 4.4上可以通过DisplayManager来创建VirtualDisplay也是可以实现录屏,但因为权限限制需要ROOT。 (see DisplayManager.createVirtualDisplay())

Related repositories
android10/Android-CleanArchitecture

This is a sample app that is part of a series of blog posts I have written about how to architect an android application using Uncle Bob's clean architecture approach.

JavaMavenApache License 2.0android-cleanarchitecturearchitectural
15.5k3.3k
OWASP/mastg

The OWASP Mobile Application Security Testing Guide (MASTG) is a comprehensive manual for mobile app security testing and reverse engineering. It describes technical processes for verifying the OWASP Mobile Security Weakness Enumeration (MASWE) weaknesses, which are in alignment with the OWASP MASVS.

PythonPyPICreative Commons Attribution Share Alike 4.0 Internationalmobile-apppentesting
mas.owasp.org
13.1k2.8k
OWASP/owasp-mastg

The Mobile Application Security Testing Guide (MASTG) is a comprehensive manual for mobile app security testing and reverse engineering. It describes the technical processes for verifying the controls listed in the OWASP Mobile Application Security Verification Standard (MASVS).

PythonPyPICreative Commons Attribution Share Alike 4.0 Internationalmobile-apppentesting
mas.owasp.org
12k2.4k
JessYanCoding/MVPArms

⚔️ A common architecture for Android applications developing based on MVP, integrates many open source projects, to make your developing quicker and easier (一个整合了大量主流开源项目高度可配置化的 Android MVP 快速集成框架).

JavaMavenApache License 2.0mvprxjava
10.2k2.4k
maxrave-dev/SimpMusic

A cross-platform music app using YouTube Music for backend

KotlinGNU General Public License v3.0androidandroid-application
simpmusic.org
10k485
H-M-H/Weylus

Use your tablet as graphic tablet/touch screen on your computer.

Rustcrates.ioOthertouch-screenhardware-acceleration
9.4k378
wgh136/PicaComic

A comic app built with Flutter, supporting multiple comic sources.

DartMIT Licenseflutterdart
8.7k1.1k
zhanghai/MaterialFiles

Material Design file manager for Android

KotlinGNU General Public License v3.0androidandroid-application
play.google.com/store/apps/details
8.6k671
Droid-ify/client

Clutterfree F-Droid client

KotlinGNU General Public License v3.0androidfdroid
droidify.app
7.1k203
Kunzisoft/KeePassDX

Lightweight vault and password manager for Android, KeePassDX allows editing encrypted data in a single file in KeePass format and fill in the forms in a secure way.

KotlinGNU General Public License v3.0keepassandroid
keepassdx.com
7k382
igorwojda/android-showcase

💎 Android application following best practices: Kotlin, Coroutines, JetPack, Clean Architecture, Feature Modules, Tests, MVVM, DI, Static Analysis...

KotlinMIT Licensekotlinandroid
6.8k908
chrisbanes/tivi

Tivi is a TV show tracking Android app, which connects to trakt.tv

KotlinApache License 2.0traktandroid-application
6.7k895