如何在Android中使用Mediaprojection库捕获屏幕并转换成mp4文件? [英] How to use Mediaprojection library in android to capture screen and convert into mp4 file?
本文介绍了如何在Android中使用Mediaprojection库捕获屏幕并转换成mp4文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
自android 5.0起,他们提供了mediaprojection库来捕获屏幕内容.但是他们提供的示例演示应用程序尚不清楚.您可以在此处找到示例应用.在该应用程序中,他们正在使用virtualdisplay方法投影捕获的屏幕
Since android 5.0 they are providing mediaprojection library to capture screen content. but sample demo application provided by them is not clear. U can find sample app here. In that application they are projecting captured screen using virtualdisplay method
private void setUpVirtualDisplay() {
Log.i(TAG, "Setting up a VirtualDisplay: " +
mSurfaceView.getWidth() + "x" + mSurfaceView.getHeight() +
" (" + mScreenDensity + ")");
mVirtualDisplay = mMediaProjection.createVirtualDisplay("ScreenCapture",
mSurfaceView.getWidth(), mSurfaceView.getHeight(), mScreenDensity,
DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
mSurface, null, null);
mButtonToggle.setText(R.string.stop);
}
我想为我的屏幕录制应用程序将捕获的屏幕转换成mp4文件.请帮助我解决这个问题.
I want to convert captured screen into mp4 file for my screen recording application. Please help me to get through this.
推荐答案
此处是示例代码参考
这篇关于如何在Android中使用Mediaprojection库捕获屏幕并转换成mp4文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文